Created
September 4, 2014 14:51
-
-
Save thoschworks/8071009fcd32997be991 to your computer and use it in GitHub Desktop.
CleanMediumURL.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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