Skip to content
Advertisement

How to download a website where javascript code lookup results are included? [closed]

How to download a copy of a website in linux?

I have tried using wget --recursive --level=inf https://example.com however it also downloaded links from different domains.

Also is there a way to download a copy of the website where the javascript has run and resulted in output on the page. For example if downloading a weather website, there might be javascript which looks up the current temperature in the database and then renders the output. How to capture the temperature/final output?

Advertisement

Answer

Phantom.js?

JavaScript

I think this will do what you like!

The best thing to do is install from here:

http://phantomjs.org/

Basically you run it by creating javascript scripts and passing as a command line arg, e.g.

JavaScript

There are loads of examples, you can render a website as an image, for example you can do:

JavaScript

Where github.js looks like

JavaScript

This demo is at http://phantomjs.org/screen-capture.html

You can also show the webpage content as text.

For example, let’s take a simple webpage, demo_page.html:

JavaScript

And then create a test script, test.js:

JavaScript

Then in the console write:

JavaScript

You can also inspect the page DOM and even update it:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement