top | item 2676974

Ask HN: How to wget pages with javascript?

4 points| baconface | 14 years ago | reply

I need to wget a url, allow the javascript to execute, and capture the result in a file. I've tried wget, curl, httrack,plugins like lget, and links(2) and none of them execute JS.

I want something like $: firefox <url> -s <file>

Does anyone know how to accomplish this behavior without using JS?

8 comments

order
[+] dstein|14 years ago|reply
You can write a NodeJS script using the JSDom module to do this.
[+] baconface|14 years ago|reply
Thanks for the suggestion. Any idea how to accomplish this task without using JS?

I'm surprised chromium, konqueror and firefox don't offer this functionality for offline browsing.

[+] profitbaron|14 years ago|reply
Personally, I'd use http://www.phantomjs.org/ and create a script which loads the page like a browser. Once you've done that you can get it to take screenshot or use JS to pull data off the page.
[+] baconface|14 years ago|reply
Thanks. I really want to get this done with the command line and it looks like Phantom JS will do the trick.