문제

뉴스 피드, 음악, 스포츠를 보여줍니다.고마워.

 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ên Hoàng

SyndicationFeed를 사용하여 도움을 드리려고 할 수 있습니다.

MyToolKit 프로젝트를 사용하여 구현하는 예제를 확인하십시오.

http://code.msdn.microsoft.com/WindowsApps / YouTube-sample-get-youtube-e9a3e0be

및 feedURL 메소드를 사용하는 것은 v2가 아닌 v2가 아닌 오래된 API입니다.

@ lê thiên Hoàng

http://gdata.youtube.com/demo/index.html 당신이 얻고 싶어하는 것을 생성합니다.

음악을 인기를 얻으려면 RESTful API 링크는 다음과 같습니다. http://gdata.youtube.com/feeds/api/standardfeeds/mopment_view/-/- {http://gview/-/- {http://gdata.youtube.com/schemas/2007/categories.cat} 음악? Alt= RSS

그러나 YouTube API 버전 3을 사용하여 다른 범주의 비디오를 가져 오는 것이 좋고 쉽게 사용할 수있는 경우를 권장합니다.

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 & feature= youtube_gdata

하지만 재생되지 않습니다 ...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top