public RootMinPrice GetPriceInFare(SearchInputService input) { try { CrawlerHelper helper = new CrawlerHelper(); CookieCollection cookieCollection = helper.getCookieCollection("https://ameliaweb5.intelisys.ca/VietJet/ameliapost.aspx?lang=vi", "POST", getPostdata(input)); HtmlDocument htmld = helper.getDocument("https://ameliaweb5.intelisys.ca/VietJet/ameliapost.aspx?lang=vi", "POST", getPostdata2(input), cookieCollection); //File.WriteAllText("D:",htmld.DocumentNode.InnerHtml); HtmlNode nodeTemp = htmld.DocumentNode.SelectSingleNode("//div[@id='vvDepDiv']/table"); RootMinPrice root = new RootMinPrice(); root.departurePrices = new OutInBoundPrices(); root.departurePrices.prices = GetListPrices(nodeTemp, input.DepartTime); if (input.IsRoundTrip) { root.arrivePrices = new OutInBoundPrices(); nodeTemp = htmld.DocumentNode.SelectSingleNode("//div[@id='vvRetDiv']/table"); root.arrivePrices.prices = GetListPrices(nodeTemp, input.ReturnTime); } return root; } catch { return null; } }
public RootMinPrice GetPriceInFare(SearchInputService input) { CrawlerHelper helper = new CrawlerHelper(); CookieCollection c = helper.getCookieCollection("http://booknow.jetstar.com/lowfarefinder.aspx", "GET", getGetData(input)); HtmlDocument htmld = helper.getDocument("http://booknow.jetstar.com/lowfarefinder.aspx", "GET", getGetData(input), c); HtmlNodeCollection nodeTemp = htmld.DocumentNode.SelectNodes("//div[@id='departing-flight']/div/div[@class='low-fare-selector']/ul/li"); RootMinPrice root = new RootMinPrice(); root.departurePrices = new OutInBoundPrices(); root.departurePrices.prices = GetListPrices(nodeTemp); root.arrivePrices = new OutInBoundPrices(); nodeTemp = htmld.DocumentNode.SelectNodes("//div[@id='returning-flight']/div/div[@class='low-fare-selector']/ul/li"); root.arrivePrices.prices = GetListPrices(nodeTemp); return root; }