Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
When running x callback link, the file linked in x-success only opens and doesn’t run
-
I called an x callback string
‘webbrowser.open('vlc-x-callback://x-callback-url/stream?' + url +'&x-success=pythonista:/ytdl/youtub-playlist2.py?action=run&x-source=Pythonista3')’
And it opens the video from the url in VLC but when it finishes playing it only sends me back to the file “youtub-playlist2.py” but it never runs it. How can I make it run this file when the video finishes? -
-
@cvp nope. Sadly that doesn’t change anything
-
-
@spike said:
&x-success=pythonista:/ytdl/youtub-playlist2.py?action=run
Should be
&x-success=pythonista3://ytdl/youtub-playlist2.py?action=run
without anything else, I think.
You have to be sure of your folder and file names, uppercase/lowercase sensitive -
@spike this works
import webbrowser url = 'url=https://youtu.be/fgZgVNxhU04' webbrowser.open('vlc-x-callback://x-callback-url/stream?' + url +'&x-success=pythonista3://MesApps/MesPastels.py?action=run')
-
@cvp I’m sorry for reviving this issue but when running your code it still only opens the python file — as in it doesn’t run it. Is there a bug in the action=run argument in Pythonista?
-
@spike said:
Is there a bug in the action=run argument in Pythonista?
You are right, it does not work as it did six months ago
But this work,
webbrowser.open("pythonista3://MesApps/MesPastels.py?action=run")
Thus the problem seems to be in the callback
-
@cvp said:
Thus the problem seems to be in the callback
Ok after 6 months I think I’ve solved it. For some reason the x-success parameter has to be percent encoded. Idk why. I don’t even think this behavior is even officially documented anywhere. I only found out because of this random article about automating things through the drafts app (https://www.macstories.net/tutorials/guide-url-scheme-ios-drafts/).
But anyway this code should work now. Btw I just looked up percent encoder online to actually encode it bc I was too lazy to figure out a way to do it myself or figure out what percent encoding even is.
import webbrowser url = 'url=https://youtu.be/fgZgVNxhU04' webbrowser.open('vlc-x-callback://x-callback-url/stream?' + url +'&x-success= pythonista3%3A%2F%2FMesApps%2FMesPastels.py%3Faction%3Drun')
-
@spike with this, I get an "invalid url" error message.
I had also thought abouT %encoding but only the "?" Because I think an url may only contain an unique "?"Did your method work for you?
-
@spike said:
For some reason the x-success parameter has to be percent encoded
Not sure of that. Without %encoding, all works (: and /) excepted the ?action=run