错误 403 Forbidden whith Youtube API V3

错误 403 Forbidden whith Youtube API V3

问题描述:

我在使用 Youtube Api v3 时遇到问题.问题是想从上传的视频中获取信息,在执行Retrieve information for video时,出现403 Forbidden错误.

I have a problem with Youtube Api v3. The problem is that wants to obtain information from an uploaded video, when performing Retrieve information for video, I get the error 403 Forbidden.

如果我运行我使用的 url,浏览器会返回 Json me 和所有视频数据.

If I run the url I am using the browser returns Json me with all video data.

Visual Studio 错误

Visual Studio Error

浏览器中的 URL 相同.

Same Url in Browser.

 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);

对我也不起作用,访问 youtube API 时收到 403.

Wasn't working for me either, was getting a 403 for accessing the youtube API.

在 API 凭据页面上的API 限制"中添加了它以限制到 YouTube ABI,现在它工作正常.

in the 'API Restrictions' on the APIs credentials page added it to restrict to the YouTube ABI, now it's working fine.