Example #1
0
        public static IEnumerable <string> ExactHref(this string html)
        {
            var htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(html);
            var htmlNode = htmlDocument.DocumentNode;

            var nodes = htmlNode.SelectNodes("//a/@href");

            return(nodes.Select(node => HtmlParsingHelper.GetAttributeValue(node, "href")));
        }
Example #2
0
        private SearchResult Parse(string html)
        {
            var node         = HtmlParsingHelper.ToHtmlNode(html);
            var ticketsNodes = node.CssSelect("#results_add_container .ticket-new__container");
            var ticketNode   = ticketsNodes.FirstOrDefault();

            if (ticketNode != null)
            {
                var res = new SearchResult();

                res.Airline     = ParseAirline(ticketNode);
                res.Price       = ParsePrice(ticketNode);
                res.Date        = ParseDate(ticketNode);
                res.DateBack    = ParseDateBack(ticketNode);
                res.Flights     = ParseFlights(ticketNode, 0);
                res.FlightsBack = ParseFlights(ticketNode, 1);
                return(res);
            }
            return(null);
        }