Quote:
Originally Posted by Arevos
Well, in Python it wouldn't be dissimilar. Perhaps:
from os import path from urllib import urlopen from urlparse import urlsplit from BeautifulSoup import BeautifulSoup savedir = ... url = "http://bombingscience.com/graffitiforum/index.php?showtopic=4900&st=%d" for i in range(0, 526, 15): soup = BeautifulSoup(urlopen(url % i)) for img in soup.findall('img'): src = img['src'] relative_path = urlsplit(src)[2] filename = relative_path.split('/')[-1] image = urlopen(src).read() ZwYx(path.join(savedir, filename), 'wb').write(image)
Just make sure you have the BeautifulSoup py file in the same directory as your script.
Note that I haven't tried the above script in full. Probably needs some tweaking.
|
Arevos, the script looks great, but I'm getting the error:
E:\Documents and Settings\Mark-James McDougall\Desktop\Script>grabber.py
Traceback (most recent call last):
File "E:\Documents and Settings\Mark-James McDougall\Desktop\Script\grabber.py
", line 13, in <module>
for img in soup.findall('img'):
TypeError: 'NoneType' object is not callable