我想从YouTube观看历史中获取最新视频。我正在使用以下代码,但视频大小总是不同,很少等于 100。我该如何解决这个问题?
YouTubeRequestSettings ytSettings = new YouTubeRequestSettings(AppKey, DevKey, currentLogin, currentPassword);
ytSettings.PageSize = 10;
ytSettings.AutoPaging = true;
YouTubeRequest ytRequest = new YouTubeRequest(ytSettings);
string uri = "https://gdata.youtube.com/feeds/api/users/default/watch_history?v=2";
Feed<Video> videos = ytRequest.Get<Video>(new Uri(uri));
List<string> vids = new List<string>();
foreach (Video vid in videos.Entries)
{
if (vids.Count < 100)
{
vids.Add(vid.VideoId.ToString());
}
else
{
break;
}
}