Last active
January 28, 2016 10:00
-
-
Save ck196/af0b2b3357618afd5faf to your computer and use it in GitHub Desktop.
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
# Dependencies: https://github.com/alexis-mignon/python-flickr-api | |
import flickr_api as f | |
from sets import Set | |
f.set_keys(api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx', | |
api_secret = 'xxxxxxxxxxxxxxx') | |
auth = f.auth.AuthHandler() | |
ids = Set() | |
faces_file = open("fold_0_data.txt","r") | |
fail_id = open("faild_id.txt","a") | |
lines = faces_file.readlines() | |
for line in lines: | |
image_name = line.split("\t")[1] | |
image_id = image_name.split("_")[0] | |
ids.add(image_id) | |
faces_file.close() | |
for img_id in ids: | |
try: | |
photo = f.Photo(id=img_id) | |
photoUrl = photo.getPhotoFile(size_label="Original") | |
name = photoUrl.split("/")[-1] | |
photo.save("flickr/%s" % name, size_label="Original") | |
except: | |
fail_id.write(img_id+"\n") | |
pass | |
fail_id.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment