kevva / screenshot-stream

Capture screenshot of a website and return it as a stream
MIT License
236 stars 38 forks source link

Headless Chrome #40

Open kevva opened 7 years ago

kevva commented 7 years ago

Just need to create a bin-wrapper for it. Also, not sure if a streaming interface is available using https://github.com/cyrus-and/chrome-remote-interface. Worst case scenario is that we skip the streams altogether and just return a Promise or if we want to keep them, possibly just emit a data event with the buffer.

sindresorhus commented 7 years ago

The only reason we're using streams today is to improve performance, as we have to decode a huge Base64 string. If using a Promise is possible, I would much prefer that.

SamVerschueren commented 7 years ago

Just need to create a bin-wrapper for it

I tried doing that two weeks ago but gave up. I couldn't find a version of Chrome that's just one binary that we can ship. Instead I tried doing it with the full blown Chrome from my computer which is like 160 MB or something. So if you guys can point me in the right direction, happy to create the wrapper.

sindresorhus commented 7 years ago

Also, is this really something we want to maintain? For reference: https://github.com/Medium/phantomjs/issues?utf8=%E2%9C%93&q= (Note the issue count)

sindresorhus commented 7 years ago

I was hoping I could just ignore Chrome Headless until someone did a bin wrapper, so I don't have to maintain it.

SamVerschueren commented 7 years ago

I was hoping I could just ignore Chrome Headless until someone did a bin wrapper, so I don't have to maintain it.

I'm afraid that if no one of us does it, nobody will do it :p. Maintaining a bin-wrapper doesn't feel as complex as maintaining PhantomJS, or am I missing something? It's just a binary, right?

kevva commented 7 years ago

Well, I had a look at it yesterday and it doesn't seem too complex tbh. I'd just get the latest revision from here https://chromium.woolyss.com/#api and then fetch the binary. There is some logic in here that we could make us of https://github.com/scheib/chromium-latest-linux/blob/master/update.sh.

Note that I haven't actually tried it out so the files from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html might not work out of the box.

kevva commented 7 years ago

The only reason we're using streams today is to improve performance, as we have to decode a huge Base64 string. If using a Promise is possible, I would much prefer that.

It still returns a Base64 string https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot.

silverwind commented 7 years ago

puppeteer might be worth checking out.

SamVerschueren commented 7 years ago

Only works on Node 7.10+ for now though. But looks really nice.

silverwind commented 7 years ago

Yeah. It has no streaming API that I see, but we should evaluate if we can require Node.js 8, and possibly rename this package or create a new one with a more fitting name.

c0bra commented 6 years ago

@SamVerschueren the readme for puppeteer now reads:

Puppeteer requires at least Node v6.4.0,

What are the chances of getting this thing rolling again? Not sure that I would be successful at a PR but I might be able to take a stab.