2016-04-04 169 views
5

我有Youtube Api v3的问题。问题是,想要从上传的视频获取信息时,执行检索视频信息时,出现403 Forbidden错误。错误403 Forbidden whith Youtube API V3

如果我运行url,我使用浏览器返回Json与所有视频数据。

Visual Studio中的错误在浏览器中

screenshot 1

相同的URL。

screenshot 2

if (videoId != "") 
      { 

       // If the video has the same description as a video and uploaded to YouTube, then I have removed that was uploaded earlier and upload the newrequest.Service.QueryClientLoginToken(); 
       //Uri urlVideo = new Uri(String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads/{1}", hipoConfig.canal_youtube, videoId)); This is This is the URL of the version 2.0 
       Uri urlVideo = new Uri(String.Format("https://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&part=snippet", videoId, hipoConfig.clave_api)); 

       Video ExistingVideo = request.Retrieve<Video>(urlVideo); 
       log.escribirInfoLog("Informacion: El video " + ExistingVideo.VideoId + "se elimina de YouTube para ser sustituido"); 

       request.Delete(ExistingVideo); 

回答

1

您是否尝试过加入OAuth的授权要求?在检查码错误描述在YouTube Data API - Errors

禁止(403)

访问被禁止。该请求可能未被正确授权。

您可以尝试使用YouTube Data API Overview上的此文档添加OAuth作为指南。

如果您的应用程序将使用需要用户 授权任何API方法,阅读认证指南,了解如何实现 的OAuth 2.0授权。

相关问题