Skip to content

Instantly share code, notes, and snippets.

@sweinberg
Created March 8, 2014 23:12
Show Gist options
  • Save sweinberg/9440460 to your computer and use it in GitHub Desktop.
Save sweinberg/9440460 to your computer and use it in GitHub Desktop.
Open Wikipedia pages in Articles. Requires Pythonista.
import clipboard
import string
import sys
import webbrowser
try:
article = sys.argv[1]
except IndexError:
article = clipboard.get()
article = article.replace('http://en.wikipedia.org/wiki/', 'x-articles://wikipedia.org/wiki/')
article = article.replace('https://en.wikipedia.org/wiki/', 'x-articles://wikipedia.org/wiki/')
article = article.replace('http://en.m.wikipedia.org/wiki/', 'x-articles://wikipedia.org/wiki/')
article = article.replace('https://en.m.wikipedia.org/wiki/', 'x-articles://wikipedia.org/wiki/')
webbrowser.open(article)
javascript:window.location='pythonista://Articles?action=run&argv='+encodeURIComponent(document.location.href);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment