pattulus
8/2/2013 - 1:55 PM

Pythonista script for taking a URL on the clipboard, running it through Readability, then through Heck Yes Markdown, and finally dropping in

Pythonista script for taking a URL on the clipboard, running it through Readability, then through Heck Yes Markdown, and finally dropping in Day One.

Borrows heavily from http://www.macdrifter.com/2012/09/pythonista-trick-url-to-markdown.html

​import clipboard
import urllib2
import webbrowser


clipString = clipboard.get()

marky = 'http://heckyesmarkdown.com/go/?read=1&u='

queryString = marky + clipString

reqMD = urllib2.Request(queryString)
openMD = urllib2.urlopen(reqMD)
content = (openMD.read().decode('utf-8'))

text = content.encode('utf-8') + '\n'
text = urllib2.quote(text, safe='')

webbrowser.open("dayone://post?entry="+text)