public static IEnumerable <ISeekItem> GetDefaultRepo(string platform, string series) { string upperPlatform = platform.Substring(0, 1).ToUpper() + platform.Substring(1); string platformSeries = upperPlatform + DefaultDb.SeriesEnParse(series); MethodInfo methodInfo = typeof(DefaultDb).GetMethod(platformSeries + "Setup", new Type[2] { typeof(string), typeof(string) }); if (methodInfo == null) { Console.WriteLine("该平台没有 {0} 的资源!", series); return(new List <ISeekItem>()); } methodInfo.Invoke(null, new object[2] { platform, series }); IEnumerable <ISeekItem> defaultRepo = typeof(DefaultDb).GetField(platform, BindingFlags.Static | BindingFlags.Public).GetValue(null) as IEnumerable <ISeekItem>; Clear(platform); return(defaultRepo); }
//the method is based on the search engine in the platform, however, the results arent stable. As a result we have to change it. //protected override IEnumerable<ICountItem> SeekCount(IEnumerable<ISeekItem> seekItemList) //{ // List<CountItem> countList = new List<CountItem>(); // string urlPattern = "http://www.soku.com/search_video/q_"; // string regPattern = @"\Wtype=youku[\S\s]+?([\d.]+)<\b?"; // string targetUrl = urlPattern + seekItemList.First<ISeekItem>().Series; // string responseHtml = GetResponseHtml(targetUrl); // CountItem countItem; // foreach (var seekItem in seekItemList) // { // countItem = new CountItem(); // countItem.Title = seekItem.Title; // countItem.Key = seekItem.Key; // double countDouble = 0; // if (double.TryParse(GetPlayCount(responseHtml, seekItem.Key + regPattern), out countDouble)) // { // countItem.Count = (countDouble * 10000).ToString(); // } // else // { // countItem.Count = "优酷搜索引擎关键字 " + seekItem.Series + " 的搜索结果已发生变化,无法获得数据,需到优酷搜索"; // } // countList.Add(countItem); // } // return countList; //} protected override IEnumerable <ISeekItem> SeekSeriesSeeds(string series) { return(DefaultDb.GetDefaultRepo("youku", series)); }