Using youtube-dl on Android

Updated March 12, 2020

Youtube-dl is a useful command-line tool that can be used for downloading videos from all sorts of websites. It’s a very useful tool, and runs on Linux, MacOS, or Windows.

Useful Links

Here’s what it does:

http://ytdl-org.github.io/youtube-dl/about.html

Here’s how to download it:

http://ytdl-org.github.io/youtube-dl/download.html

Here’s the GitHub project page:

https://github.com/ytdl-org/youtube-dl/

Android Installation

While youtube-dl works great on PC, you can actually install it and use it on Android as well. Here’s how to do it.

youtube-dl on Android
youtube-dl on Android!

Install Termux

Install Termux from the Google Play store:

https://play.google.com/store/apps/details?id=com.termux

Termux is a nice little terminal emulator for Android that allows you to do many of the things you could normally do in Linux. Here are some of the tools available within Termux:

  • SSH
  • Rsync
  • Vim
  • CURL

See the GitHub page for the full list:

https://github.com/termux/termux-packages/tree/master/packages

Install Python

Open Termux and type the following command to install Python:

pkg install python -y

Install youtube-dl

Run the following command to install youtube-dl:

pip install --upgrade youtube-dl

Download Video

Simple Instructions

Run the following command to download a video:

youtube-dl http://example.com/video

Open a file browser on your Android device and look for a folder called “Termux”; it should contain the video you just downloaded, and you can play it right on your device. If you don’t see this folder, move on to the “Advanced” section.

This is the default Files app on a Google Pixel where you can see a shortcut to the Termux storage.

You can also list the videos you’ve downloaded by running the list command in Termux:

ls

Advanced Instructions

If you want to be able to choose the folder of your internal storage into which the videos are downloaded, do the following.

Give Termux Access Permissions

All I’m going to do is summarize the instructions from the Termux website:
https://wiki.termux.com/wiki/Internal_and_external_storage

Type the following command:

termux-setup-storage

A popup will ask for permission to access your internal storage; press Allow.

Now, you can first navigate to something like the downloads folder before initiating the download:

cd ~/storage/downloads

Next, run the download command:

youtube-dl https://example.com/video

Now, the file will be in the Downloads folder in any file explorer app, such as Google’s “Files by Google” app that you can download here:

https://play.google.com/store/apps/details?id=com.google.android.apps.nbu.files

Google's Files app showing Internal Storage slash Downloads

Summary

That’s it. It’s pretty simple to get up and running. And if you want, you can even Rsync your videos to another machine to watch them there!

4 thoughts on “Using youtube-dl on Android

  1. youtube den video indirdim ve “Termux” adlı bir klasör hem tel hemde sd arattım yok oyle bir kloser ls -al komutu ile video goruyorum dosya yoneticisi ile dosya adı aratma yaptıgımda yok gorunen dosya yok gibi saatlerde tek tek baktım yok ne inen video nede termux klasoru yok….
    uzantısı farklı bir dosyanın icine mi koyuyor yoksa ??

    1. I’ve updated the post to solve the problem of finding your files after downloading them. See the “Advanced Instructions” section.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s