Cheerio
Questions about Cheerio, an implementation of core jQuery designed specifically for the server.
Jsdom
Implementation of the WHATWG DOM and HTML Standards (among others) for node.js
Options module faster
Example |
---|
"Cheerio does not execute scripts on the page therefore you can t see this specific class;you can use selenium which is pretty heavy to run on scale or jsdom which is lighter" from question Empty output scraping with cheerio |
"If it is unavoidable node.js has good options - try to use the module cheerio which is faster than heavy weight jsdom" from question Technology for Server side DOM manipulation (Java vs Node) |
Others
Example |
---|
Jsdom is great if you have control of the page you want to crawl or server-side rendering it but be aware that site-errors will cause your node process to crash;cheerio doesn t execute javascript but merely parses the html from question Facing issue when web scraping a page table using node js |
Cheerio does not execute these scripts and as a result content may not be visible as you re experiencing;this is an article i read a while back and caused me to have the same discovery just open the article and search for jsdom is more powerful for a quick answer from question Data from web scraping using node.js request is different from data shown in the browser |
I find request + cheerio to be easier than jsdom for tasks like this from question Node Jsdom Scrape Google's Reverse Image Search |
Jsdom is a module which will provide such content but is not as lightweight;cheerio does not execute these scripts and as a result content may not be visible as you re experiencing from question Data from web scraping using node.js request is different from data shown in the browser |
You are probably better off using cheerio which is lighter than jsdom and supports most of the jquery syntax from question Update all href anchor links in folder of HTML files |
If you don t need a full dom available and just want to parse and scrape manipulate html elements there is cheerio which is more lightweight than jsdom and still gives you a jquery-like api from question Node.js & JQuery: "ReferenceError: $ is not defined" error. How do I use jquery with node on the server? |
I had the same problem with jsdom and switcht to cheerio which is much faster than jsdom and works even after scanning hundreds of sites from question Jsdom and node.js leaking memory |