1

我必须访问你管上上传的视频。在我验证用户的代码中,用户将访问该帐户。

var settings = new YouTubeRequestSettings("XYZ", "ABC",     
                  "xxx@gmail.com", "pwd");

var request = new YouTubeRequest(settings);

var service = new YouTubeService("XYZ");

service.setUserCredentials("xxx@gmail.com", "pwd");
var token = service.QueryClientLoginToken();
service.SetAuthenticationToken(token);

Uri uri = new Uri("http://gdata.youtube.com/feeds/api/users/default/uploads");
Feed<Video> videoFeed = request.Get<Video>(uri);

VideoUrlList = new List<VideoInformation>();
foreach (Video entry in videoFeed.Entries)
{
    VideoUrlList.Add(new VideoInformation
    {
        VideoId = entry.VideoId,
        VideoUrl = "http://www.youtube.com/embed/" + entry.VideoId
    });
}

我在本地环境中使用的代码运行良好。但是相同的代码在服务器上产生身份验证异常。

“服务器响应状态为 500(内部服务器错误)”

任何机构都可以建议我如何解决这个问题吗?提前致谢。

4

0 回答 0