Tag: youtube api

YouTube V3 API – Google.Apis.Requests.RequestErrorBackend错误

后端错误[503]后端错误[503]后端错误[503]后端错误[503]

用于access_token的Youtube API C#OAuth令牌交换返回无效请求

我正在尝试在其Google帐户中对用户进行身份validation,以访问和修改其Youtube数据。 我设法获得从用户登录和条款接受返回的令牌,但是当我执行POST以交换用户access_token的令牌时,它在Json文件上返回“无效请求”。 以下是我显示登录页面的方式: string url = string.Format(“https://accounts.google.com/o/oauth2/auth?client_id=XXXXXXX&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://gdata.youtube.com&response_type=code&access_type=offline”); WBrowser.Navigate(new Uri(url).AbsoluteUri); 我使用HttpWebRequest来发布POST string url = “https://accounts.google.com/o/oauth2/token?code=XXXXXX&client_id=XXXXXXXXX&client_secret=XXXXXXXXX&redirect_uri=http://localhost/oauth2callback&grant_type=authorization_code”; HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(url); byte[] byteArray = Encoding.UTF8.GetBytes(url); httpWReq.Method = “POST”; httpWReq.Host = “accounts.google.com”; httpWReq.ContentType = “application/x-www-form-urlencoded; charset=utf-8”; httpWReq.ContentLength = byteArray.Length; 但它失败了: HttpWebResponse myHttpWebResponse = (HttpWebResponse)httpWReq.GetResponse(); 出现以下错误: 如果设置ContentLength> 0或SendChunked == true,则必须提供请求正文。 通过在[Begin] GetResponse之前调用[Begin] GetRequestStream来完成此操作。 然后我将我的POST请求更改为TcpClient,如下所示: TcpClient client = new TcpClient(“accounts.google.com”, 443); […]

YouTube上传文件给我ArgumentNullException(C#)

我正在使用Google“Client Library for .NET”进行YouTube服务。 当我尝试上传video时,我的[Videos.Insert]请求中出现了错误。(System.ArgumentNullException)。 ArgumentNullException: Value cannot be null. Parameter name: baseUri 堆: в Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) в Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) в Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) в Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() в Google.Apis.Upload.ResumableUpload`1.d__e.MoveNext() в c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\output\default\Src\GoogleApis\Apis\[Media]\Upload\ResumableUpload.cs:строка 459 我的代码: X509Certificate2 certificate = new X509Certificate2(@”test.p12″, “notasecret”, X509KeyStorageFlags.Exportable); ServiceAccountCredential credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(“test@developer.gserviceaccount.com”) { Scopes = new[] { YouTubeService.Scope.YoutubeUpload, YouTubeService.Scope.Youtube, YouTubeService.Scope.YoutubeReadonly } }.FromCertificate(certificate)); […]

使用Youtube v3 Api键

我正在尝试构建一个基于youtube的应用程序,我正在使用Youtube Data API的3.0版本,我确实在Google Cloud Console中注册了该应用程序,并且我确实获得了一个API密钥。 之后我尝试在Visual Studio 2010中的控制台应用程序中测试它,我使用WebClient使用此URL检索video搜索“ https://www.googleapis.com/youtube/v3/search?part=snippet&q=YouTube + Data + API&type = video&key = {MY API KEY}“ 我从这里学到了这个。 我使用了浏览器密钥和服务器密钥,但是服务器发回错误说该请求不正确。 所以有人能指出我正在犯的错误吗? PS:我正在尝试制作Windows手机应用程序,在此之前我想学习如何首先操作Youtube API,这就是我在控制台应用程序中测试的原因

如何使用YouTube API获取随机YouTubevideo?

我需要一种获取完全随机的YouTubevideo的方法。 没有限制。 如何使用YouTube API? **编辑*确定这里要求的是我到目前为止尝试的: 1 – 在youtube开发站点浏览了api和示例。 http://www.youtube.com/dev/没有运气找到正确的api或在那里做的方式。 2 – 谷歌搜索当然;)得到http://randomyoutubevideo.net/但他们只提供从他们在我和youtube之间使用的API。 <这让我希望实际上可以做到这一点。 3 – 甚至检查了youtube应用程序库http://youtube-gallery.appspot.com/ ,看看有没有人这样做。 如何。 我还要做的是在youtube讨论页面上询问。 也许有人可以提供帮助。