I was traveling recently and wanted to watch some videos while not overusing the
shared wifi connection on the train. I had been marking my videos as to watch with the
iOS/macOS app Play.
Since Play has shortcuts support, I figured it should not be too hard to download the videos
to my Mac. It did take me longer than I hoped but I eventually found a solution that works well enough
for me. It starts with this very simple shortcut:
The first steps gets the videos from Play (filtered by those that have not been watched yet) and the second
step gets the
Url field for every video, turning it into a list of YouTube URLs.
I originally tried to also include the actual downloading in the shortcut but I couldn’t figure out how to properly pass variables to Terminal actions or how to truncate a list while retaining the PlayVideo->Url extraction.
So instead, I now use this shortcut from the command line where it is wrapped in a tiny fish command substitution and then forwarded to yt-dlp like this:
yt-dlp (shortcuts run Play | head -n 5)
Note that by default, the
shortcuts command line app does not print to stdout. You need to pipe it to
head or a similar
tool if you want to see the output. I wanted to limit my output anyway (as not to download all videos I had marked as to watch) so this worked well for me.
So that’s my setup now, a shortcut with two steps and a super simple shell script. I like how easy this was in the end but it took me quite a while to get there and the split between Shortcuts and shell seems quite arbitrary to me. But it does work. Hopefully, this also helps some of you.