Question

montrer une nouvelle nourriture, musique, sports.merci.

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

J'utilise:

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;

Erreur: Ne trouvant pas d'aliment, demande ...

Était-ce utile?

La solution

Il y a à l'aide de 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 { }
    }

Autres conseils

lê thiên hoàng

Vous pouvez essayer d'utiliser SyndicationFeed pour vous aider,

Vérifiez cet exemple, qui utilise le projet MyToolkit pour mettre en œuvre.

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

Et vous utilisez la méthode WederURL est une ancienne API qui est v2 non v3.

@ lê thiên hoàng

en utilisant http://gdata.youtube.com/demo/index.html Pour générer, vous voulez obtenir.

Si vous voulez obtenir de la musique populaire, votre lien API reposant est: http://gdata.youtube.com/feeds/api/tandardfeeds/mest_weviewed/-/ {http://gdata.youtube.com/schemas/2007/categories.cat} Musique? Alt= RSS

Mais je recommande si vous le pouvez, à l'aide de YouTube API Version3, est meilleur et plus facile à obtenir une vidéo de catégorie différente.

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

    }

Je reçois cette source: Source: http://www.youtube.com/watch? v= _oblgsz8ssm & fonctionnalité= youtube_gdata

Mais il ne joue pas ...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top