Last active
June 28, 2017 09:30
-
-
Save erika-dike/ab1b502bcf0da2a008ba05fabadef8db to your computer and use it in GitHub Desktop.
Auto download of images on a site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def download_images(prefix, dirname, links): | |
length = len(links) | |
for index, link in enumerate(links): | |
print 'Downloading {0} of {1} images'.format(index + 1, length) | |
url = prefix + link | |
response = requests.get(url, stream=True) | |
save_image_to_file(response, dirname, index) | |
del response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment