Question

to show a news feed, music, sports. thanks.

 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);
              }
            }
    }

I'm using:

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;

Error: not finding Feed, request...

Was it helpful?

Solution

There is using 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 { }
    }

OTHER TIPS

Lê Thiên Hoàng

You can try to use SyndicationFeed to help you,

check this example, which using Mytoolkit project to implement.

http://code.msdn.microsoft.com/windowsapps/Youtube-Sample-Get-Youtube-e9a3e0be

and you using feedUrl method is an old api which is v2 not v3.

@Lê Thiên Hoàng

using http://gdata.youtube.com/demo/index.html to generate you want to get.

if you want get music popular, then your RESTFul Api link is: http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed/-/{http://gdata.youtube.com/schemas/2007/categories.cat}Music?alt=rss

But I recommend if you can, using Youtube API Version3, is better and easier to get different category video.

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();
        }

    }

I receive this source :Source :http://www.youtube.com/watch?v=_OBlgSz8sSM&feature=youtube_gdata

But it is not playing...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top