I found Fizzler as an html parser and jQuery as a selector. But it seems that visual studio cannot resolve the QuerySelectorAll
method.
here is my code:
using HtmlAgilityPack; HtmlAgilityPack.HtmlWeb web = new HtmlWeb(); HtmlAgilityPack.HtmlDocument document = web.Load(url); var c = document.QuerySelectorAll('div');
Did I miss any links?
EDIT: after some searching, I found this code to use Fizzler
HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); const string search = "td"; SelectorGenerator<HtmlNode> selectorGenerator1 = new SelectorGenerator<HtmlNode>(new HtmlNodeOps()); HumanReadableSelectorGenerator selectorGenerator2 = new HumanReadableSelectorGenerator(); Parser.Parse(search, new SelectorGeneratorTee(selectorGenerator1, selectorGenerator2)); var c = selectorGenerator1.Selector(Enumerable.Repeat(doc.DocumentNode, 1)).ToList();
I am still looking to find a good answer for my question.
source share