Created
February 27, 2014 04:01
-
-
Save KainokiKaede/9244149 to your computer and use it in GitHub Desktop.
This is a Pythonista (for iOS) script to obtain short URL of your photo from Flickr photostream. Please download [base58](https://gist.github.com/mursts/2247355) module before use.
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
'''Usage: hold at your favorite photo | |
and copy the URL, then press Done. | |
''' | |
username = 'kainokikaede' | |
# Download base58 module from here and place it in the same directory: | |
# https://gist.github.com/mursts/2247355 | |
from base58 import Base58 | |
import re | |
import clipboard | |
import webbrowser | |
webbrowser.open('http://www.flickr.com/photos/{0}/'.format(username), modal=True ) | |
url = clipboard.get() | |
photo_id = re.search('([0-9]{10,})', url).group(1) # nasty! plz help improving this. | |
encoded_id = Base58().encode(photo_id) | |
short_url = 'http://flic.kr/p/{0}'.format(encoded_id) | |
clipboard.set(short_url) | |
print 'copied: ', short_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment