Hacker News new | ask | show | jobs
by AlphaWeaver 3035 days ago
Cheerio [0] is fantastic for this as well...

[0]: https://www.npmjs.com/package/cheerio

2 comments

I've tried Cheerio as well, but I prefer JSDOM since it exposes the DOM APIs. What I'll normally do is interactively test things out in the browser's console, and then transfer em over to my script. Browser dev tools are just super amazing.
Agreed - I find the Cheerio APIs to be awkward when traversing deep into the DOM. Last time I used Beautiful Soup I found it also had this problem. The DOM API that JSDOM provides is such much more natural to work with.
Cheerio is so much faster and more lightweight than jsDOM. If you can do it with Cheerio, you absolutely should.
Using Cheerio with TypeScript types to parse data from tables in downloaded HTML files. Great tool.