paulhammond / webkit2png

png screenshots of webpages

Home Page:http://www.paulhammond.org/webkit2png/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to capture full page of Medium articles

oliverwaters opened this issue · comments

I've noticed that webkit2png doesn't capture the full page of Medium articles.

Example URL: https://medium.com/startup-lesson-learned/3204170324ed

Resulting Image:
generation y cant we sleep startup lessons learned medium 20140311

Huh, interesting. Looks like a medium page isn't actually a normal webpage - there's a div the size of the browser window which has overflow:auto set on it so when you scroll you're scrolling just the contents of that div and not the whole page. So, the trick used by webkit2png to capture the whole page doesn't work.

There's a variable in the data sent by the server (GLOBALS.useragent.requiresBodyScroll) that controls this behavior based on the user agent. But I can't work out which user agent would trigger this to be set to false (and even if you can find one that does it's likely to break the Typekit fonts that also use user agent sniffing to work). If you save a copy of the page locally and change this parameter then none of the protocol-relative urls work. If you serve that page from a localhost webserver then some kind of error checking kicks in and renders an error message instead of the page.

Oh, and if you just try making the browser window really tall then the header image is stretched to whatever height you specify.

I've got no real ideas on what else to try...

Okay, thanks for looking in to this. I've used --user-agent='iPad' for now to get around this.

Glad to hear that's working for you. I'm closing this as I can't see any other useful fixes we could add.