Call URL Scheme from the mac (in python?)

I realize this is a bit of an edge case … but.
On my phone I use this nifty shortcut by @ryanjamurphy to make really nice looking copies of web archives for future references in DT/DTTG.

I’m trying to get the same functionality on my Mac. I’ve mostly duplicated the downloading/rewriting part of the shortcut using beautiful soup, in python.
I’ve also understood NOT to use x-callback-url on my mac.

The issue I have now is that urlopen(x-devonthink://…) won’t work in python.

What would be the best way to programatically open a DT Url Scheme on the mac, ideally in Python?

Alternatively, without using Python, does anyone have another idea to create the same kind of clean-looking output as the above mentionned shortcut?

1 Like

I’m sure there’s a way to complete the workflow in Python, but Keyboard Maestro is an alternative. It is essentially Shortcuts for MacOS: https://www.keyboardmaestro.com/main/

Please share the results, though! I’ve been meaning to port the functionality over but haven’t had the chance.

1 Like

While I’m not suggesting we support python, this works as expected…

>>> import webbrowser
>>> str="x-devonthink-item://131CDAC3-6494-4847-91FE-365ED8081A3C"
>>> webbrowser.open(str, new=0)
3 Likes

No python support implied or expected :slight_smile:
But thanks for pointing me in the right direction … Will try.
Also, @ryanjamurphy, you are absolutely right: Keyboard Maestro can be seen as Shortcuts for Mac :slight_smile: I’ll use it.

1 Like