public override Factory.IFactory GetFactory() { if (this.BaseUri.LocalPath.StartsWith("/feeds/api/videos/")) { // Is a video return new SimpleFactory(this); } else if (this.BaseUri.LocalPath.StartsWith("/feeds/api/playlists/")) { // Is a playlist ParamYoutubeSearchVideos newPars = new ParamYoutubeSearchVideos( "", ParamYoutubeSearchVideos.OrderBy.relevance, 1, 10); //--- Array.ForEach( Pars.Data.Keys.ToArray(), delegate(string key) { if (newPars.Data.ContainsKey(key)) { newPars.Data[key] = Pars.Data[key]; } else { newPars.Data.Add(key, Pars.Data[key]); } }); //--- return new PagesFactory(this); } return null; }
public static UriYoutubeFeed GetStandardFeed( STANDARD_FEED_REGION region, STANDARD_FEED_TYPE type, STANDARD_FEED_CATEGORY category, YoutubeDesktop.Youtube.UriYoutube.ParamYoutubePageable.STANDARD_FEED_TIME time = YoutubeDesktop.Youtube.UriYoutube.ParamYoutubePageable.STANDARD_FEED_TIME.all_time) { object[] args = new object[] { region, type, category }; string format = "http://gdata.youtube.com/feeds/api/standardfeeds"; if (region != STANDARD_FEED_REGION.none) { format += @"/{0}"; } if (category == STANDARD_FEED_CATEGORY.none) { format += @"/{1}"; } else { format += @"/{1}_{2}"; } ParamYoutubeSearchVideos par = new ParamYoutubeSearchVideos( "", ParamYoutubeSearchVideos.OrderBy.relevance, 1, 10); //--- if (time != YoutubeDesktop.Youtube.UriYoutube.ParamYoutubePageable.STANDARD_FEED_TIME.all_time) par.Data["time"] = time.ToString(); return new UriYoutubeFeed( string.Format(format, args), par); //--- }
public static UriYoutubeFeed GetStandardFeed( STANDARD_FEED_TYPE type, YoutubeDesktop.Youtube.UriYoutube.ParamYoutubePageable.STANDARD_FEED_TIME time = YoutubeDesktop.Youtube.UriYoutube.ParamYoutubePageable.STANDARD_FEED_TIME.all_time) { //--- ParamYoutubeSearchVideos arg = new ParamYoutubeSearchVideos("", ParamYoutubeSearchVideos.OrderBy.relevance, 1, 10); arg.Data["time"] = time.ToString(); return new UriYoutubeFeed(String.Format("http://gdata.youtube.com/feeds/api/standardfeeds/{0}", type), arg); }
public static UriYoutubePlaylists GetPlaylists(String username) { if (String.IsNullOrEmpty(username)) username = "******"; ParamYoutubeSearchVideos parm = new ParamYoutubeSearchVideos("", ParamYoutubeSearchVideos.OrderBy.relevance, 1, 10); return new UriYoutubePlaylists( string.Format("https://gdata.youtube.com/feeds/api/users/{0}/playlists", username), parm); //--- }