I'm writing a scraper in node. Is there a module out there that will allow me to work with css selectors?
For locating elements by using their text contents, CSS selectors and XPath provide methods to find text within the elements. If an element contains specific text, this will return the element back to the test.
If you just want to parse HTML and your HTML is intended for the body of your document, you could do the following : (1) var div=document. createElement("DIV"); (2) div. innerHTML = markup; (3) result = div. childNodes; --- This gives you a collection of childnodes and should work not just in IE8 but even in IE6-7.
Look at the excellent jsdom, and specifically this section, where it shows how you can leverage jQuery in Node to scrape HTML documents, thus using the CSS-like selectors that jQuery offers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With