rodbegbie (owner)

Revisions

gist: 218527 Download_button fork
public
Description:
Hacky script to remove all the Polar Rose notes now that Flickr has proper persontagging
Public Clone URL: git://gist.github.com/218527.git
Embed All Files: show embed
remove_polarrose.py #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
 
import flickrapi
import unicodedata
 
api_key = ""
secret = ''
flickr = flickrapi.FlickrAPI(api_key, secret, token='72157622540482605-f58378ebf472c802')
 
walker = flickr.walk(user_id='35034351963@N01', per_page=200)
for photo in walker:
info = flickr.photos_getInfo(photo_id=photo.attrib["id"])
title = info.find("photo").find("title").text
title = unicodedata.normalize('NFKD', unicode(title)).encode('ASCII', 'ignore')
print "Working on", title
for note in info.find("photo").find("notes").findall("note"):
text = note.text
text = unicodedata.normalize('NFKD', unicode(text)).encode('ASCII', 'ignore')
print "**** NOTE FOUND", text
if "polarrose.com" in text:
print "********** DELETING! ************ "
flickr.photos_notes_delete(note_id=note.attrib["id"])