Skip to content

Instantly share code, notes, and snippets.

@yurivictor
Created June 19, 2012 19:04
Show Gist options
  • Save yurivictor/2955923 to your computer and use it in GitHub Desktop.
Save yurivictor/2955923 to your computer and use it in GitHub Desktop.
Grab all the user profile photos from Facebook
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