Skip to content

Instantly share code, notes, and snippets.

@tdhopper
Last active December 20, 2015 13:39
Show Gist options
  • Save tdhopper/6140068 to your computer and use it in GitHub Desktop.
Save tdhopper/6140068 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment