Skip to content

Instantly share code, notes, and snippets.

@ger-
Created December 4, 2013 20:08
Show Gist options
  • Save ger-/7794594 to your computer and use it in GitHub Desktop.
Save ger-/7794594 to your computer and use it in GitHub Desktop.
chaining-lessn-tweetbot: Clicking this (javascript:window.location='pythonista://chaining-lessn-tweetbot?action=run&argv='+encodeURIComponent(document.location.href);) bookmarklet will launch this pythonista script to grab the webpage url and use Lessn to shorten it and then launch compose dialog of Tweetbot with the shortened url. Note: add you…
import webbrowser
import clipboard
import urllib
import sys
import console
import urllib2
l = sys.argv
link=l[1]
lessn='http://'yourdomain'/'x'/-/?api='API key'&url='
link=urllib.quote(link,safe='')
short= lessn+link
u= urllib2.urlopen(short)
content = (u.read().decode('utf-8'))
clipboard.set(content)
tip=clipboard.get()
tip=urllib.quote(tip,safe='')
bot='tweetbot:///post?text='
tweetbot= bot+tip+'/'
webbrowser.open(tweetbot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment