• funnymanva

    Ok, so the change must have been in Shortcuts. It wasn’t running the URL just making it so it would go to the next step. I guess they changed that function and my Shortcut I hadn’t touched in forever. I changed the shortcut to Safari’s Open URL and now it works. I did take the suggestion to prompt for Audio/Video or just Audio in Shortcuts and pass that as an argument. Sorry I couldn’t figure out why it just broke.

    posted in Pythonista read more
  • funnymanva

    @cvp I tried this and no difference. It’s odd that these all used to work at some point. I’ve also noticed if I just assume always audio it doesn’t download the audio from YT. It’s like it doesn’t run it properly.

    posted in Pythonista read more
  • funnymanva

    Just some additional information.z I took everything out and just did the console.alert and it still doesn’t pop up.

    posted in Pythonista read more
  • funnymanva

    I have installed Stash and have a Python script I’ve used for a long time to download audio or audio/video from Youtube with the youtube_dl library. It is launched from a Shortcut and has worked for a while. I’ve noticed at some point, not sure which iOS version or when, but now when I use the Shortcut it doesn’t seem to work at all. The first thing in the script is a console.alert that asks the user if they want to download audio/video or audio only. This doesn’t pop up at all. I’m using the right pythonista3 URL as if I copy the URL of a YT video and click the pythonista3:// url in a note where I have it saved it works completely fine. From Shortcuts it shows a little box on the top of the screen (this is an iPad Pro 2018) that says “scripting” I believe and then it just disappears. It obviously doesn’t download the video or anything since it never even seemed to run the console.alert. Did something change and I have to update this script? I’ll include it below., but it’s not very complicated. The end of the script opens the folder where the file is downloaded to. All this works running directly after copying a YT URL into the clipboard. I just can’t figure out why not from Shortcuts.

    from __future__ import unicode_literals
    import youtube_dl
    import clipboard
    import console
    import shortcuts
    
    link = clipboard.get()
    
    mediaformat = console.alert('Choose Format', '', 'Video/Audio', 'Audio Only', hide_cancel_button=True)
    
    if mediaformat == 1:
        ydl_opts = {
            'outtmpl': 'youtube_dl/%(title)s.%(ext)s'
        }
    else:
        ydl_opts = {
            'outtmpl': 'youtube_dl/%(title)s.%(ext)s',
            'format': 'bestaudio[ext=m4a]'
        }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        info = ydl.extract_info(link, download=True)
        title = info.get('title')
    
    shortcuts.open_url('shareddocuments:////private/var/mobile/Library/Mobile%20Documents/iCloud~com~omz-software~Pythonista3/Documents/youtube_dl')
    
    

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!