我正在尝试以C#显示我的YouTube channel 中的视频列表,但不能。
当我运行程序时,出现这样的错误:
YouTubeRequestSettings settings = new YouTubeRequestSettings("my app name",
"my devkey",
"my email", "my password");
YouTubeRequest request = new YouTubeRequest(settings);
string feedUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads";
Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl));
foreach (Video entry in videofeed.Entries)
{
list.Items.Add(entry);
}
任何帮助将不胜感激。
最佳答案
看起来应该是
YouTubeRequest settings = new YouTubeRequest(ayarlar);
否则,您尝试将尚未实例化的
settings
变量作为参数传递给YouTubeRequest
构造函数。从评论更新
由于您需要全局变量,因此请勿在此处创建新实例并使用现有实例
//earlier code
string feedUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads";
//the Feed<Video> has been removed because you want to use the global variable
videoFeed = request.Get<Video>(new Uri(feedUrl));
foreach (Video entry in videofeed.Entries)
{
list.Items.Add(entry);
}
关于c# - 显示我的YouTube channel 中的视频列表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17263965/