public static List <string> getAlbumLinks(ScrapingBrowser Browser, string albumCategoryLink) { List <string> albumUrls = new List <string>(); WebPage PageResult = Browser.NavigateToPage(new Uri(albumCategoryLink)); GetAlbumsByPrefixResponse response = JsonConvert.DeserializeObject <GetAlbumsByPrefixResponse>(PageResult.ToString()); if (response.code == 0 && response.data != null && response.data.Count > 0) { albumUrls = response.data.Select(a => DOMAIN_WITHOUT_SLASH + a.urlalbum).ToList(); } return(albumUrls); }
public static void GetAlbumDataOfCategory(ScrapingBrowser Browser, string albumCategoryLink) { WebPage PageResult = Browser.NavigateToPage(new Uri(albumCategoryLink)); GetAlbumsByPrefixResponse response = JsonConvert.DeserializeObject <GetAlbumsByPrefixResponse>(PageResult.ToString()); try { if (response.code == 0 && response.data != null && response.data.Count > 0) { using (CrawlDatabaseEntities crawlDataContext = new CrawlDatabaseEntities()) { crawlDataContext.Album_Data.AddRange(response.data); crawlDataContext.SaveChanges(); } } }catch (Exception ex) { Console.WriteLine("Error on GetAlbumDataOfCategory: {0}", ex.Message); } }