public static async void thisOneWaits(String pageUrl) { var ht = await WebScraper.getHtmlAsync(pageUrl); var test = new WebScraperListPage(ht); while (test.getNextPage() != null) { List <String> playerurls = new List <String>(); List <Task <HtmlDocument> > playerHtmls = new List <Task <HtmlDocument> >(); test.getPlayersUrls(playerurls); foreach (var playerUrl in playerurls) { Console.WriteLine("loading new page"); var webHtml = WebScraper.getHtmlAsync(WebScraper.baseUrl + playerUrl); playerHtmls.Add(webHtml); } foreach (var playerHtml in playerHtmls) { var html = await playerHtml; var playerScraper = new WebScraperPlayerPage(html); Player player = new Player(playerScraper); } var nextPage = test.getNextPage(); ht = await WebScraper.getHtmlAsync(nextPage); test = new WebScraperListPage(ht); }//for the page webscraper }
public static async void getHtmlAsync(String url) { var i = await Task.Run(() => WebScraper.getHtmlAsync(WebScraper.baseUrl + url)); var j = new WebScraperPlayerPage(i); Console.WriteLine(j.getOverallRating()); }
public Player(WebScraperPlayerPage playerPage) { this.playerPage = playerPage; var dataArrs = playerPage.getJsonData(); try { this.pcPriceData = dataArrs[0]; Console.WriteLine(pcPriceData[0][0].GetType()); Console.WriteLine(pcPriceData[0][1].GetType()); this.xboxPriceData = dataArrs[1]; this.psPriceData = dataArrs[2]; } catch (Exception e) { Console.WriteLine("Error in loading price data"); Console.WriteLine(e.GetType()); } var ctl = playerPage.findCTL(); this.country = Convert.ToString(ctl[0]); this.team = Convert.ToString(ctl[1]); this.league = Convert.ToString(ctl[2]); this.name = playerPage.getName(); }