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; }
public static YoutubeUrl Create(Uri u) { var url = new YoutubeUrl { Uri = u, Type = VideoUrlType.Unknown, Provider = ContentProviderType.Youtube, ChannelId = "", FeedId = "", Id = "", VideoId = ""}; var parameters = DownloadHelper.GetParams(u.Query); if (parameters.Count > 0 && parameters.ContainsKey("v")) { url.Id = parameters["v"]; url.VideoId = url.Id; url.Type = VideoUrlType.Video; } return url; }
public override void OnLoadResource(WebView view, string url) { base.OnLoadResource(view, url); if(url.Contains("&v=")) try { _youtubeUrl = YoutubeUrl.Create(new Uri(url)); if (!String.IsNullOrEmpty(_youtubeUrl.VideoId)) { Controls.DownloadButton.Enabled = true; } else { Controls.DownloadButton.Enabled = false; } } catch {} }