Download YouTube Videos or Extract MP3s on IPhone Using A-Shell and Yt-dlp
by andreimagic in Living > Life Hacks
25 Views, 0 Favorites, 0 Comments
Download YouTube Videos or Extract MP3s on IPhone Using A-Shell and Yt-dlp

If you want to download YouTube videos or extract MP3 audio directly to your iPhone, you can do so using the free a-Shell app and the open-source yt-dlp tool. This method works without jailbreaking and provides flexibility similar to a desktop terminal.
Tips
- Use only for personal, fair-use downloads.
- Some videos may be restricted due to region or age limitations.
- Keep yt-dlp updated by re-downloading it from GitHub occasionally.
Supplies

Sources:
- a-Shell: https://apps.apple.com/app/id1473805438
- yt-dlp: https://github.com/yt-dlp/yt-dlp
- iPhone or iPad: Requires iOS 14.0 or later
Installing Yt-dlp in A-Shell



- Install the a-Shell app
- Open the App Store and install a-Shell, a local terminal emulator for iOS.
- Launch a-Shell and set up the directory
- Open the app and run the following commands one by one:
mkdir ~/Documents/bin
cd ~/Documents/bin
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O
chmod +x yt-dlp
cd ~/Documents
- Test yt-dlp functionality
- Try downloading a video:
yt-dlp "https://www.youtube.com/watch?v=G1oxqQj8tuI"
- Try extracting MP3:
yt-dlp -x --audio-format mp3 --audio-quality 0 -P ~/Documents/ "https://www.youtube.com/watch?v=G1oxqQj8tuI"
- Your files will appear in the a-Shell directory under Files > On My iPhone > a-Shell. If playback fails in the default player, try using VLC or IINA.
Creating an IOS Shortcut to Automate Downloads






Open the Shortcuts app and create a new shortcut
Add an input step
- Add "Ask for Input", set the prompt to YouTube URL.
Add a menu to choose download type
- Add "Choose from Menu" with two options:
- Extract MP3
- Download Video
For "Extract MP3" option
- Use the "Execute Command" action (becomes available with the installation of a-Shell):
yt-dlp -x --audio-format mp3 --audio-quality 0 -P ~/Documents/ "Ask for Input"
For "Download Video" option
- Similarly (note that "Ask for Input" is a Selectable Variable):
yt-dlp -P ~/Documents/ "Ask for Input"
Finish the menu and save your shortcut
- Label it something like "YT-DLP"
Optionally add Home Screen widget "Shortcuts" to have a quick way of accessing your latest shortcuts!