How to use python youtube-dl in android – no root

By | February 3, 2019

youtube-dl is a popular python package for video downloading. With youtube-dl you can easily download videos from many popular sites. Its quite easy to use youtube-dl in android.

First we need to install Termux in android. From Termux official web:

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically – additional packages are available using the APT package manager.

Read in more details from Termux Wiki. The wiki includes, user-interface explanations, quick how-tos, package information and more.

Follow this link to download the app from google play. Alternatively you can search for ‘Termux’ at Google Play Store, install the app.

termus play store


After installing the app, open the app. It will automatically install some necessary packages. Then write

plg list-all

This will list out all the available packages from termux. Notice the python packages here. The default python package is the python3 package. It also includes python3-pip.

Install the python package with

pkg install python

It will install the python package and also install pip.

After installing verify the installation via

python --version

and to verify pip

pip --version

Now we are ready to install youtube-dl package. Install it via-

pip install youtube-dl

It may take some time, however, after installation it will be ready! Check it via

youtube-dl --version

Now your android device is ready to use youtube-dl!

Get a URL from youtube, and do:

youtube-dl <your-video-url>

The youtube-dl will download the video eventually. Please ensure your current directory using ‘pwd’. The ‘pwd’ command will echo the current working directory. Change to your desired directory using ‘cd’ to download in other locations. If you want to download file in your SD Card or in internal storage, first turn on the storage permission for the app. Then know your storage directory > cd your-dir > download.


Sometimes, you may need to update your package. Often, the video sites update their video playback engine, hence, you also need to update your youtube-dl package to its latest form.

To update the youtube-dl packages, do

pip install --upgrade youtube-dl

If the package is already in the latest form it will just skip, otherwise it will update it.