Many Android users wonder how to download Youtube videos on their phone. This seemingly simple question invariably leads them to a handful of third-party apps that get the job done, though not always efficiently. For example, see Appual’s article “Why Converting YouTube to 320KBPs MP3 is a Waste of Time”. These third-party apps can also be full of ads.
There is a much simpler way to download either full videos or audio rips from YouTube, using only an Android terminal. In this Appuals guide, we will show you exactly how to accomplish this, no root required!
The first step is to download and install the terminal emulator of your choice.
Give the terminal app storage permissions if they are not requested on launch by default. You can do this by going into your Settings > Apps > (emulator app) > Permissions > Enable Storage Access.
Now in the terminal app, enter all of the following commands on individual lines:
termux-setup-storage packages install python pip install youtube-dl mkdir /data/data/com.termux/files/home/storage/shared/Youtube mkdir -p ~/.config/youtube-dl apt-get install nano
(The last command is going to install nano text editor. This will allow us to easily set up our config file for the youtube-dl process).
Open your youtube-dl config file in nano text editor with this terminal command:
Now add the following lines to the config file:
--no-mtime -o /data/data/com.termux/files/home/storage/shared/Youtube/%(title)s.%(ext)s -f "best[height<=480]" [You can replace 480 with 360, 720, or 1080 for video resolution quality. if you want to download audio only, replace best[height<=480] with 140, so that it just reads -f 140]
Now because there is no CTRL+S to save our changes in nano editor, we need to use the volume keys instead of CTRL as a keyboard (unless you are using a keyboard over USB-OTG). So to save your config file in nano, press Volume Down + O (on the Android screen keyboard), and exit with Volume Down + X.
Now when you are back in the terminal emulator, you need to type a few more commands. This will link Youtube-dl’s native terminal commands to the “Share” menu in the official YouTube app.
mkdir ~/bin cd ~/bin
And we will create and config a new file in nano once again:
And add the following line to this new config file, then save and exit nano.
Now we are ready to test everything. You can launch YouTube and go to any video, then tap the “Share” button. You should see a Termux button and icon. Pressing this button will download the video to your Android phone!