bocca bocca - 2 months ago 8
HTML Question

Download html page and its content

Does python have any way of downloading entire html page and its contents (images, css) to local folder given a url. And updating local html file to pick content locally.

Answer

You can use the urllib module to download individual URLs but this will just return the data. It will not parse the HTML and automatically download things like CSS files and images.

If you want to download the "whole" page you will need to parse the HTML and find the other things you need to download. You could use something like Beautiful Soup to parse the HTML you retrieve.

This question has some sample code doing exactly that.