4 ms·
That's a neat little library. The problem is that the web is rapidly moving away from having HTML as the main information carrier to HTML merely being an envelo
by jacquesm 9y ago
That's a neat little library. The problem is that the web is rapidly moving away from having HTML as the main information carrier to HTML merely being an envelope to deliver a bunch of JavaScript (and if you're even more unlucky: WebAsm).
Scraping the web will become a lot harder in the future.
- MildlySerious 9y agoThen again things keep becoming more API driven, with the JS delivered just containing the views. If it gets easier or harder remains to be seen I think
- simonw 9y agoI'm a lot less worried about that thanks to Chrome Headless and the puppeteer library: https://github.com/GoogleChrome/puppeteer https://github.com/GoogleChrome/puppeteer puppeteer makes scripting headless Chrome for scraping-style tasks trivial, and it's supported by the Chrome development team so it's likely to keep on working long into the future.
- ivan_ah 9y agoIs there a difference between Chrome+puppeteer vs Chrome+selenium? Is there anything special that Chrome headless has that ordinary Chrome wouldn't have?
- simonw 9y agoI know plenty of people who dislike working with Selenium. I haven't yet met anyone who's had enough experience with Puppeteer to hate it yet.
- nojvek 9y agoChrome headless is just that. Chrome that’s headless. Selenium is a cross browser api that connects to browser via some port. But usually it’s a high level api since it’s a common denominator of browser apis. Selenium uses middleware webdriver libs sometimes and usually quite bloated. Puppeteer uses Chrome Remote Debug Protocol, which is the same protocol Devtools uses. It’s just a simple JSON RPC over websockets. Puppeteer creates a nice library abstraction over this api. The advantage of puppeteer over selenium is that you have a lot more control over chrome. Network, perf, screenshots, coverage, dom & style traversal, etc. It’s a very reliable API too since Chrome Devtools team maintains the backend. Selenium on the other hand surprises me with all sorts of quirks.
- nurettin 9y agoBeen using selenium and webdriver with ruby for the past five years, there is pretty much nothing it cannot do. Performance is a big hit, though.
- make3 9y agoI really love Selenium actually.. makes me feel.. powrful, somehow, like an evil genius or something
- nurettin 9y agoMy evil genius moment with selenium happened when I ran a headless client to visit the login page of a bank, wait for 2fa sms code from my Android application, then use the code to log in and place some automated stock orders.
- jpalomaki 9y agoOr easier? You just need to look the endpoints the Javascript is using to get the data in JSON.
- laktek 9y agoEven in JS heavy sites, the rendered output is still HTML. You just need to make sure you add a pre-render step. Page.REST, a micro-service I wrote a couple of months back follows this strategy.
- madeofpalk 9y agoIn saying that, Javascript is just as parsable, and these 'javascript sites' are probably loading structured data via a JSON API which will probably be easier to scrape than a bunch of layout HTML.
- deleted 9y ago[deleted]
- tobyhinloopen 9y ago> Scraping the web will become a lot harder in the future. Meh, if you're lucky you can grab raw data from API requests. Otherwise just let the javascript execute in a headless browser and continue scraping.