I am writing a scraper that downloads all the image files from a multiple pages across the same site and saves them to a specific folder
the pages have only one variable which changes, and each page only holds one image.
(example: http://www.example.com/photos/ooo1.jpg ...http://www.开发者_JAVA技巧example.com/photos/1745.jpg)
I'm currently building the script with python and beautfulSoup but am having a problem creating a loop with the changing variable. I just getting started with python, so thanks for the help.
for i in xrange(1, 1746):
file = urllib2.urlopen("http://www.example.com/photos/%04d.jpg" % i)
...
# Write file locally
...
You don't need Beautiful soup if you already know the image urls.
精彩评论