If your whole stack is JS and you need a little bit of web scraping, this makes sense. If you're starting a new scraping project from scratch, I think you'll get far further, faster, with Python or Ruby.
If your whole stack is JS and you need a little bit of web scraping, this makes sense. If you're starting a new scraping project from scratch, I think you'll get far further, faster, with Python or Ruby.
I scrape for a living and I work with JS, because currently, it has the better tools.
I prefer JS + jsdom/cheerio as it's closer to the in-browser experience for scraping.
I'm currently working to turn my hobby scraper into something profitable. "Working with strings" is already the least of my concern. I've spent most of the time with finding an architecture / file structure that allows me to
- easily handle markup changes on source-pages and
- quickly integrate new sources
I've feared it would be impossible to handle unexpected structural changes from a multitude of sources. Turns out that rarely happens. Like, once every x years per source's page-type.
I think from es6 and up this is handled pretty well.
Python/Ruby are far more expressive for these sorts of data manipulation tasks.
String manipulation and collections on Python are not an after thought, the syntax and API make them convenient and easy to use.
Text are DOM nodes. If I were making a business of this I would automate the shit out of it by:
1) Gather all text nodes directly
2) Eliminate all text nodes that only contain white space
3) Add context. Since text nodes are DOM nodes you can get information about the containing element directly from the node itself.
Hands down walking the DOM will be programmatically faster to write and execute than anything else you can write in any language.
Here is some tiny code that does just that: https://github.com/prettydiff/semanticText