public Root CreateXmlDocument(SearchInputService input) { try { CrawlerHelper helper = new CrawlerHelper(); Root root = new Root(); root.Departure = input.DepartureCode; root.Arrival = input.ArrivalCode; 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); root.outBound = new OutInBound(); root.inBound = new OutInBound(); root.AirLine = AirLineName.vietJetAir; HtmlNodeCollection collection; try { collection = htmld.DocumentNode.SelectNodes("//div[@id='toDepDiv']/div[@id='travOpsMain']/table[1]/tr[7]/td/table[1]/tr"); root.outBound.Items = getitems(input.DepartTime,input, collection); } catch { } //chieu ve if (input.IsRoundTrip) { collection = htmld.DocumentNode.SelectNodes("//div[@id='toRetDiv']/div[@id='travOpsMain']/table[1]/tr[7]/td/table[1]/tr"); root.inBound.Items = getitems(input.ReturnTime,input, collection); } return root; } catch { return null; } }
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; }