Windows Store C#のLoad Feeds YouTube API V3
-
21-12-2019 - |
質問
ニュースフィード、音楽、スポーツを表示する。ありがとう。
private void loadfeedYoutube()
{
string feedUrl="https://gdata.youtube.com/feeds/api/standardfeeds/most_popular";
var request=new
Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl));
printVideoFeed(videoFeed);
static void printVideoFeed(Feed<Video> feed)
{
foreach (Video entry in feed.Entries)
{
printVideoEntry(entry);
}
}
}
.
私は使っています:
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.Upload;
using Google.Apis.Util.Store;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
.
エラー:フィードを見つけない、リクエスト...
解決
MyToolKit
を使用しています private void GetYoutubeChannel(string feedXML)
{
try
{
SyndicationFeed feed = new SyndicationFeed();
feed.Load(feedXML);
List<YoutubeVideo> videosList = new List<YoutubeVideo>();
YoutubeVideo video;
foreach (SyndicationItem item in feed.Items)
{
video = new YoutubeVideo();
video.YoutubeLink = item.Links[0].Uri;
string a = video.YoutubeLink.ToString().Remove(0, 31);
video.Id = a.Substring(0, 11);
video.Title = item.Title.Text;
video.PubDate = item.PublishedDate.DateTime;
video.Thumbnail = YouTube.GetThumbnailUri(video.Id, YouTubeThumbnailSize.Large);
videosList.Add(video);
}
MainListBox.ItemsSource = videosList;
}
catch { }
}
. 他のヒント
LıThiënHoàng
SyndicationFeedを使ってあなたを助けることができます、
MyToolkitプロジェクトを実装するためにこの例を調べます。
http://code.msdn.microsoft.com/WindowsApps / youtube-sample-get-youtube-e9a3e0be
とFEEDURL法を使用することは、V2ではない旧APIです。
@lêthiênhoàng
http://data.youtube.com/demo/index.html あなたが取得したいのです。
あなたが人気のある音楽を取得したいのなら、あなたのRESTFUL APIリンクは次のとおりです。
しかし、YouTube API Version3を使うことができる場合は、さまざまなカテゴリビデオを取得する方が良いことをお勧めします。
void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
{
try
{
DataModel.YoutubeVideo value = e.NavigationParameter as DataModel.YoutubeVideo;
if(!string.IsNullOrWhiteSpace(value.id))
{
txttitle.Text = value.title;
Mediaplayer.Source = value.youtubelink;
}
}
catch
{
throw new NotImplementedException();
}
}
.
このソースを受け取る: http://www.youtube.com/watch?v= _oblgsz8ssm&amp; feature= youtube_gdata
しかしそれは遊んでいません...
所属していません StackOverflow