How to download YouTube videos with youtube-dl on iPad and iPhone
Youtube-dl is one of my favorite utilities on Mac and Windows and I missed this on the iPad for downloading YouTube videos. But, not anymore. Recently I discovered how to install Youtube-dl on the iPad for downloading videos and audio files. The set-up requires a few steps, but once done, it works better than it does on a PC or Mac.
To make this work, you need the Shortcuts app and a-Shell or a-Shell mini.
Step 1: download the Shortcuts app and a Shell
Go to the App Store and download [Shortcuts] and [a-Shell mini]. The latter will probably do for most people. If you need to compile C, a TeX engine or numpy and matplotlib, than you download [a-Shell]. In this blog, I just use the name a-Shell and add the Shortcut for both apps. The full version of a-Shell takes up to 700 MB more storage on your iPhone and iPad.
Step 2: set-up a-Shell for youtube-dl
Setting up a-Shell consists of two steps. The first is installing youtube-dl on the iPad or iPhone through a-Shell:
- Open a-Shell.
- Install youtube-dl package by entering the command
pip install youtube-dland hit Enter/Return.
The script runs just like it does on a regular PC or Mac and youtube-dl is now installed on your iPad or iPhone.
Next, we need to add the ffmpeg command:
- First we download it from Github:
- Use this link for a direct download of ffmpeg: https://github.com/holzschu/a-Shell-commands/releases/download/0.1/ffmpeg.wasm.
- This link brings you to the Github page with more commands: https://github.com/holzschu/a-Shell-commands.
- Open the Files app and go to the a-Shell folder. This can be iCloud or local. In this folder, create a new folder and name it “bin”.
- In the Files app go to the folder where the file is downloaded. Select the file and move it to the bin folder we created in the previous step.
You can now use youtube-dl or create an app Shortcut. The latter is step 3 and makes using youtube-dl on the iPhone and iPad a breeze.
Step 3: add the youtube-dl app Shortcut
The Download Media Shortcut has three main steps:
- Select what the type of content. Audio or Video. For this a List is added and the Choose from option.
- An If statement. Based on the chosen file type it decides whether it puts the downloaded file in the Audio folder or Videos folder. It also creates these folders in the a-Shell folder if they don’t exist.
- Executing the shell command (a-Shell).
You run the Shortcut from the share menu, e.g. on YouTube, like you’re used to.