protected static List <IScraper> InitScrapers(Dictionary <int, string> urlDic) { List <IScraper> scraperList = new List <IScraper>(); foreach (KeyValuePair <int, string> item in urlDic) { IScraper scraper = null; if (Utility.findString(item.Value, "amazon")) { scraper = new AmazonScraper(item.Key, item.Value); } else if (Utility.findString(item.Value, "backmarket")) { scraper = new BackMarketScraper(item.Key, item.Value); } if (scraper != null) { scraperList.Add(scraper); } } if (scraperList.Count == 0) { throw new System.InvalidOperationException("There is no scraper recognized in the list!"); } return(scraperList); }
public static List <IScraper> InitScrapers(List <string> urlList) { List <IScraper> scraperList = new List <IScraper>(); foreach (string strUrl in urlList) { IScraper scraper = null; if (Utility.findString(strUrl, "amazon")) { scraper = new AmazonScraper(); } else if (Utility.findString(strUrl, "backmarket")) { scraper = new BackMarketScraper(); } if (scraper != null) { scraperList.Add(scraper); } } return(scraperList); }