0

I have to download the webpage so as to obtain original html content before javascript changes the html in Node.js or it can be via terminal.

This action can be performed by terminal with the help wget but there is a problem. When i am doing wget www.example.com/example/example1 or curl -o www.example.com/example/example1 in both cases it is downloading the view-source code

Abhishek Tripathi
  • 1,570
  • 3
  • 20
  • 32
  • What do you mean it is downloading only part of it? – loganfsmyth Jan 22 '15 at 22:54
  • Let me explain first, as you know the content of web page which you see in view-source is different from the one when you save the webpage as html. This is because javascipt changes the content when u see the view-source. So, can you please tell me the way to save the webpage so that i can get original content before it is changed by the javascript. – Abhishek Tripathi Jan 22 '15 at 23:09
  • Any request made by the serverside will get the content of the file, without executing any javascript, so what you're asking for would be the default behaviour of any request middleware you can find. – adeneo Jan 22 '15 at 23:47
  • Sorry, my question was, you said `wget www.example.com/example/example1 is downloading only part of it`, what does that mean? `wget` should definitely work unless something is going wrong elsewhere. – loganfsmyth Jan 23 '15 at 02:30
  • sorry i corrected it. I think now it is clear – Abhishek Tripathi Jan 23 '15 at 09:05
  • [This question](https://stackoverflow.com/questions/4720343/loading-basic-html-in-node-js) might help you. Seems like it has already been answered. Something you might Google is 'HTTP GET request node js'. – chris Jan 22 '15 at 23:26
  • The answer given in that question also leads to download the content visible in the view-source code not the original html code. I have already seen that question. – Abhishek Tripathi Jan 22 '15 at 23:40
  • The question was "How to download whole page in .html format in node.js?" Seems like that's what that is doing. What is the difference between "view-source code" and "original html code"? – chris Jan 23 '15 at 00:04
  • There is a difference. You please read my second comment, I have explained it there. – Abhishek Tripathi Jan 23 '15 at 00:11

0 Answers0