I am trying to restore the source of a webpage, including any images. At the moment I have this:
import urllib page = urllib.urlretrieve('http://127.0.0.1/myurl.php', 'urlgot.php') print urlgot.php
which the source is extracting, but I also need to download any related images.
I thought I could create a regex that looked for img src or the like in a loaded source; however, I was wondering if there is a urllib function that will also receive images? Like the wget command:
wget -r --no-parent http://127.0.0.1/myurl.php
I do not want to use the os module and run wget, since I want the script to run on all systems. For this reason, I cannot use third-party modules.
Any help is much appreciated! Thanks
Jingo
source share