Download Any Videos on the Internet with Android Terminal

There are tons of online sites and Android apps, that let you download videos from the Internet. But how about we do this, with Android terminal (No ROOT required). Sounds geeky? Well, let’s see how to do it. 

Related: 3 Ways to Loop YouTube Videos on Android and iOS


  1. No need to leave the YouTube app or any app for that matter
  2. No need to download any third party app that is filled with ads
  3. Set it up once and forget forever.


  1. Need some tinkering with Android terminal
  2. You don’t have multiple download options (360p or 480 etc) like you get in other apps

So, how is it going to work?

Well, say, you are watching any video in the YouTube app and you want to download it. So simply tap on the share icon on the top right. Select termux app. This will launch a terminal emulator, and run some commands. And that’s it, your video is downloaded, in the YouTube folder of file manager

This method support around 1250 sites including all the popular video sites – YouTube, Vimeo, Facebook, twitch etc. You can check out the complete list on YouTube-dl supported sites page.

I highly recommend you watch the following video first, in this post, I’ll be explaining the steps and fixing some common errors that you might get while trying the method. So, let’s get started, shall we?

Download Any Videos on the Internet with Android Terminal

Step 1

Head over to Google play Store and download any terminal emulator app. For this instance, let’s go with Termux.

Step 2

Now, since it’s our first-time setup, we’ll have to type in some terminal commands. Don’t worry, all these commands are simple. And don’t require any root access. You can download this file (Google drive) and copy paste them one by one to your terminal.

If you have ever work in the terminal, you might know, it’s always a good deal to update your repository. So, type

apt update && apt upgrade

and then press Y to confirm changes.

(Note: If  you get an error apt-get: not found, scroll down the end of the article, I’ll have all solutions there)

Step 3

Next, you need to give termux access to your device’s filesystem, So type in following command and press enter.


Step 4

Next, we need to install YouTube-dl package, that will do all the magic in the background. But, YouTube-dl needs python to work. So, first, you need to install python.

packages install python

and then press Y to confirm changes.

Step 5

Okay, now we are ready to install YouTube-dl

pip install youtube-dl

Step 6

Now, even if you have YouTube-dl, you still need to tell it, where to save all the downloaded videos. And which resolution to download. So, first let’s create a folder to store your downloaded videos

mkdir /data/data/com.termux/files/home/storage/shared/Youtube

Now, if you go to the root of your internal storage, you should see a folder called YouTube.

Step 7

Now come back to the terminal. We have to tell YouTube-dl — ‘Whenever I’m downloading a YT video, it should have this default name and this resolution’

And to do this, we’ll, create config files and add all the rules in it. So, to create a config file. Type this command.

mkdir -p ~/.config/youtube-dl

Step 8

Now, to add rules to this config file, we need some terminal editor. You just simply can’t write stuff like you normally do. So install nano text editor with the following command

apt-get install nano

Step 9

Okay, now we add rules to the config file.  Open it with nano editor with this command. 

nano ~/.config/youtube-dl/config

Step 10

And copy-paste the following rules i.e. what is the default download folder, title, and resolution. For this instance, I’m going with 480p, which obviously, you can replace with 360, 720 or 1080p. If you want to download only audio, use 140, more on that at the end of this article.


-o /data/data/com.termux/files/home/storage/shared/Youtube/%(title)s.%(ext)s

-f “best[height<=480]”

Now, usually, to save changes we do CTRL + S right. But since, we don’t have any CTRL key on Android. These terminal emulators use vol down key as CTRL key. So, save your changes and exit the app press use the following command.

“Volume-down” + O to save changes and press enter. And then close nano with “Vol-down” + X


Step 11

Okay, now once are back in the editor. You need to do one final thing i.e. linking Youtube-dl terminal command with the share menu of Youtube or (any app for that matters)

Again, we need to create a file and add rules in it. Just like we did in the previous step. So, type this command

mkdir ~/bin

cd ~/bin

nano termux-url-opener

Step 12

So, far we have created a bin folder and in that, we have created a new file called – termux-url-opener. This will open the nano editor, paste the following command in it.

youtube-dl $1

Save with “Volume-down” + O, press Enter, and then close nano with “Vol-down” + X

Now, let’s test it

Open YouTube app (remember it works for any app though, as long as you get share option), click the “Share” link under the video and choose “Termux“. The download will start and once finished. You can find it under the YouTube folder.

Common Problems and their solutions

1. no command ‘apt-get’ found, did u mean: command ‘apt-get’ from package ‘apt’

Chances are you are typing Apt-get instead of apt-get. Most keyboard app capitalizes the first letter. Terminal is case sensitive

2. mkdir: can’t create directory ‘/data/data/com.termux/files/home/storage/shared/Youtube’: No such file or directory

Either you already have a folder with the name YouTube in your internal storage or you have not given storage access to termux properly. Make sure you are not using any screen overlay app like screen recorder or Deskdock etc. If you are, then disable them temporary and rewrite the storage access code i.e. termux-setup-storage

3. What are the codes to download the audio

Thanks to YouTube user – Gabi Tiplea for providing the tip, If you want to download only audio replace “best[height<=480]” with 140 so in the final, you will have -f 140 instead of -f “best[height<=480]. I tried it and it worked fine.

4. How to get pop-up options with different download format like 360, 480, 720p etc, like you get in YouTube downloader app?

We are still working on it. With some good codes, it’s possible. But unfortunately, due to a busy schedule, I’m not able to put time on it. If you guys have an idea, shoot me an email or leave a comment below.

Related: How Much Money do YouTubers make? Answered by YouTubers


Related posts

4 Ways to Find Deleted Apps on Android

Top 6 Ways to Stop Apps From Starting Automatically on Android

How to Get iOS 16 Features on Android