private static void FillFeed(XmlDocument xml, MSYoutubeEntry feed)
 {
     feed.Title = GetNodeValue(xml.DocumentElement, "root:title");
     feed.Author = GetNodeValue(xml.DocumentElement, "root:author/root:name");
     feed.AuthorId = GetNodeValue(xml.DocumentElement, "root:author/yt:userId");
     var nextPageUri = GetNodeValue(xml.DocumentElement, "root:link[@rel='next']/@href");
     feed.NextPageUri = (String.IsNullOrEmpty(nextPageUri)) ? null : new Uri(nextPageUri);
     string stotal = GetNodeValue(xml.DocumentElement, "openSearch:totalResults");
     int total;
     feed.Total = (int.TryParse(stotal, out total)) ? total : 0;
     var nodes = GetNodes(xml.DocumentElement, "root:entry");
     foreach (XmlElement node in nodes) {
         var entry = new MSYoutubeEntry();
         entry.Title = GetNodeValue(node, "root:title");
         entry.Description = GetNodeValue(node, "media:group/media:description");
         string tmp;
         foreach (XmlElement thumbNode in GetNodes(node, "media:group/media:thumbnail")) {
             var thumbnail = new MSYoutubeThumbnail {
                 Url = GetNodeValue(thumbNode, "@url"),
                 Height = GetNodeValue(thumbNode, "@height"),
                 Width = GetNodeValue(thumbNode, "@width")
             };
             entry.Thumbnails.Add(thumbnail);
         }
         tmp = GetNodeValue(node, "root:link[@rel='alternate']/@href");
         Uri uri;
         if (!Uri.TryCreate(tmp, UriKind.Absolute, out uri)) continue;
         entry.Uri = uri;
         feed.Entries.Add(entry);
     }
 }
 public void _GetAsync(Uri uri, MSYoutubeEntry feed, MSYoutubeLoading loading)
 {
     
     if (feed.NextPageUri == null) return;
     var document = GetXmlDocumentAsync(feed.NextPageUri);
     FillFeed(document, feed);
     if (loading != null) loading(feed.Entries.Count, feed.Total);
     _GetAsync(uri, feed, loading);
 }
 public MSYoutubeEntry GetAsync(YoutubeUrl youtubeUrl, Uri uri, MSYoutubeLoading loading)
 {
     var feed = new MSYoutubeEntry {
         YoutubeUrl = youtubeUrl,
         NextPageUri =
             new Uri(uri + ((String.IsNullOrEmpty(uri.Query)) ? "?" : "&") + "start-index=1&max-results=40")
     };
     _GetAsync(uri, feed, loading);
     return feed;
 }