python - Save a dynamic page to a file or web archive -


I want to save a page to my disk (also to open it off-line) If the page is very basic: Some text, some images, some links etc. I have no problem. But if I want to save a page like https://www.python.org/ I have many problems with the granphix I was trying to:

  Htmldata = urllib2.urlopen ('https://www.python.org/') .read () F = Open ('myfile.html', 'w') F.write (htmldata) f.close () < / Code> 

But when I open my file, I: Enter image details here

Even if I try to save any img from the page (subscribe to bs4 to use BS 4 By doing yoga), she got only one image. My file page is still there, so how can I save a page to open it off-line? Maybe it should not be .html file but anything else?

You can download HTML images, CSS, URLs in JS and download them, and then change Ulls in HLR and Set file location on your disk.

BTW: Probably the new URL will need the file: // prefix.

BTW: Some images can be defined in CSS or JS files. So you have to find the URL in CSS and JS, download them and replace the URL in CSS and JS in HTML.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -