Skip to content

Instantly share code, notes, and snippets.

@thoschworks
Created September 4, 2014 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoschworks/8071009fcd32997be991 to your computer and use it in GitHub Desktop.
Save thoschworks/8071009fcd32997be991 to your computer and use it in GitHub Desktop.
CleanMediumURL.py
# CleanMediumURL
#
# by Thomas Schewe
#
# Cleans copied Links from the Medium App.
#
# Shared Links from the Medium App have the format
# "$TITLE" by $AUTHOR $URL
#
# This script seperates the URL from the link in the clipboard
# and saves the URL back to the clipboard.
#
import clipboard
import console
import re
medium_url = clipboard.get()
m = re.search('(https://medium.com/p/[0-9a-f]*)' , medium_url)
if m:
clipboard.set(m.group(1))
else:
console.alert('Error','No valid URL from the Medium App in the clipboard.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment