View Single Post
Old Jan 19th, 2007, 6:52 PM   #9
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
Well, in Python it wouldn't be dissimilar. Perhaps:
python Syntax (Toggle Plain Text)
  1. from os import path
  2. from urllib import urlopen
  3. from urlparse import urlsplit
  4. from BeautifulSoup import BeautifulSoup
  5.  
  6. savedir = ...
  7.  
  8. url = "http://bombingscience.com/graffitiforum/index.php?showtopic=4900&st=%d"
  9.  
  10. for i in range(0, 526, 15):
  11. soup = BeautifulSoup(urlopen(url % i))
  12.  
  13. for img in soup.findall('img'):
  14. src = img['src']
  15.  
  16. relative_path = urlsplit(src)[2]
  17.  
  18. filename = relative_path.split('/')[-1]
  19.  
  20. image = urlopen(src).read()
  21.  
  22. open(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 is offline   Reply With Quote