YouTube-dl on an Android phone
So one of the podcasts I listen to is the Accidental Tech Podcast (ATP) and one of the recurring topics around episode 300 has been an iOS app called iSH and the use of youtube-dl. iSH gives you access to a terminal shell on your iOS device and youtube-dl is a command line python app to download content from various online sources. I use youtube-dl quite a lot for various uses and honesty it’s become the go-to tool for some things now.
This got me thinking — I have an Android phone, why can’t I do this?
Well I can, and the instructions seem to be scattered across the internet so here is what I did from top to bottom.
(Heads up — I am using an Original Google Pixel 128GB on Android 9. Your mileage may vary on the below)
(Also, I’ll put all the commands at the bottom of this post so you can just “lift and shift” into Termux)
- Download Termux from Google Play
- Open Termux and run the following:
termux-setup-storageThis will allow Termux to access / write to the Android filesystem outside its own contrainer
- Then run
pkg upgradewhich will allow Termux to update it's internal packages (think like apt-get)
- Once complete, install python by running
pkg install python. This will install Python (the language YouTube-dl is developed in) and also pip, the python dependency manager
- Once python is installed, time to install YouTube-dl (finally). Run
pip install youtube-dland wait some time.
- Lastly (optional possibly) I installed ffmpeg as I usually install it when I install YouTube-dl (this is as on some streams it will use ffmpeg to merge separate audio and video streams together).
pkg install ffmpeg
- Thats you
So to test it out you can now change the directory to the Downloads directory (
cd ~storage/downloads) and attempt to download a video (
youtube-dl https://youtu.be/BaW_jenozKc). If all works, you will see a freshly downloaded video file in your Downloads folder.
At the moment I have not worked out a use for this yet, but it’s nice to know I can use it in a pinch if I need to (such as when traveling and WiFi in your accommodation is hard to come by)
This will take you through to having a video downloaded to your Downloads folder. For use in Termux
pkg install python
pip install youtube-dl
pkg install ffmpeg