Created
July 22, 2015 09:35
-
-
Save tommorris/9c8440c89ffed0fc35bc to your computer and use it in GitHub Desktop.
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
try: | |
# Python 3 | |
from urllib.parse import urlparse | |
except ImportError: | |
# Python 2.x | |
from urlparse import urlparse | |
def evernote_url_to_ios_url(url): | |
parsed = urlparse(url) | |
assert parsed.netloc == "www.evernote.com" or parsed.netloc == "sandbox.evernote.com | |
split_path = parsed.path.split("/") | |
shard_id = split_path[2] | |
user_id = split_path[4] | |
note_guid = split_path[5] | |
return "evernote:///view/{shard_id}/{user_id}/{note_guid}/".format( | |
shard_id=shard_id, user_id=user_id, note_guid=note_guid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Documentation: https://dev.evernote.com/doc/articles/note_links.php