Live data from Hacker News

Show HN: Headless Chrome Crawler

github.com

1–10 of 39 posts

Re: Show HN: Headless Chrome Crawler

#4

Can't see from examples, how do I get back individual elements from the body?

Not a user of this tool, but https://github.com/yujiosaka/headless-chrome-crawler#event-n... points to https://github.com/GoogleChrome/puppeteer/blob/master/docs/a... where you can grab elements.

Basically, when new page event happens, you get the `page` object where you have access to it and can do queries.

Re: Show HN: Headless Chrome Crawler

#6

also how does this handle pages that load with a small number of links and then uses JS to write in a bunch of DOM nodes and links?

I don't know about this project specifically, but typically with headless Chrome, you let it run the JS and then read the DOM.

Re: Show HN: Headless Chrome Crawler

#7
post #5

Pretty cool, but I recommend anyone wanting to do this kind of thing to check out the source Puppeteer library. You can do some really powerful stuff and make a custom crawler fairly easily. https://github.com/GoogleChrome/puppeteer

Yeah I’d really rather that people made extensions to Pupeteer rather than a whole new library.

Re: Show HN: Headless Chrome Crawler

#8
post #5

Pretty cool, but I recommend anyone wanting to do this kind of thing to check out the source Puppeteer library. You can do some really powerful stuff and make a custom crawler fairly easily. https://github.com/GoogleChrome/puppeteer

Puppeteer seems needlessly difficult to use on a VPS. I'd prefer an easily dockerized version but there seems to be nothing robust and they make it VERY hard to connect to a docker instance just running Chrome for the websocket/9222 interface sadly.

Re: Show HN: Headless Chrome Crawler

#9
post #4

Can't see from examples, how do I get back individual elements from the body?

Not a user of this tool, but https://github.com/yujiosaka/headless-chrome-crawler#event-n... points to https://github.com/GoogleChrome/puppeteer/blob/master/docs/a... where you can grab elements. Basically, when new page event happens, you get the `page` object where you have access to it and can do queries.

`page.$(query)` or `page.$$(queryAll)` to be more specific

https://github.com/GoogleChrome/puppeteer/blob/v1.1.0/docs/a...

Post reply on HN