Created
June 19, 2012 19:04
-
-
Save yurivictor/2955923 to your computer and use it in GitHub Desktop.
Grab all the user profile photos from Facebook
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 get_photos(): | |
RANGE_TOP = 1 | |
RANGE_BOTTOM = 500000000 | |
# Iterates through the list of images | |
for i in range(RANGE_TOP, RANGE_BOTTOM): | |
# Gets the image from the url | |
request = requests.get('http://graph.facebook.com/%i/picture?type=normal' % i) | |
# Opens a file locally | |
file = open('%i.jpg' % i, 'w') | |
# Writes the image to the file | |
file.write(request.content) | |
# Closes the file | |
file.close() | |
print 'Saving %i' % i | |
get_photos() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment