Skip to content

Instantly share code, notes, and snippets.

@mskian
Last active January 6, 2021 14:03
Show Gist options
  • Save mskian/6ea9c2b32d5f41867e7cafc88d1b26d5 to your computer and use it in GitHub Desktop.
Save mskian/6ea9c2b32d5f41867e7cafc88d1b26d5 to your computer and use it in GitHub Desktop.
Bash Shell Script - youtube-dl Downloader for Termux Terminal Emulator
#!/bin/bash
# -----------------------------------------------------------------------------
# Info:
# author: Santhosh veer
# file: youtube-dl.sh
# created: 18.09.2018
# revision: 18.09.2018
# version: 0.3
# -----------------------------------------------------------------------------
# Requirements:
# Python, ffmpeg, cURL
# Description:
# youtube-dl Downloader for Termux Terminal Emulator
#
# -----------------------------------------------------------------------------
## Update packages
echo "+++ Updating the Packages +++"
echo "+++ Running Command pkg up +++"
pkg up
echo -e "\\n"
echo "+++ Packages are Updated Successfully +++"
sleep 2;
echo -e "\\n"
## Install dependency packages
echo -e "+++ Install dependency packages +++"
sleep 2;
echo -e "\\n"
echo -e "+++ Install python +++"
echo -e "\\n"
pkg install python -y
sleep 2;
echo -e "+++ Install cURL +++"
echo -e "\\n"
pkg install curl -y
sleep 2;
echo -e "\\n"
echo -e "+++ install ffmpeg (For Audio Conversion) +++"
echo -e "\\n"
pkg install ffmpeg -y
sleep 2;
echo -e "\\n"
echo -e "+++ Successfully Installed the dependency packages +++"
sleep 2;
echo -e "\\n"
## Download Youtube-dl
echo -e "+++ Downloading Youtube-dl +++"
echo -e "+++ Please Wait +++"
curl -s -L https://yt-dl.org/downloads/latest/youtube-dl -o /data/data/com.termux/files/usr/bin/youtube-dl
sleep 2;
echo -e "+++ Youtube-dl Downloaded Successfully +++"
echo -e "\\n"
sleep 2;
## Set Permission
echo -e "+++ Set Permission to Execute the Script +++"
chmod a+rx /data/data/com.termux/files/usr/bin/youtube-dl
echo "+++ Permission Granted +++"
sleep 2;
echo -e "\\n"
## Verify the Installation
echo -e "+++ Verifiy Installation +++"
youtube-dl --version
command -v youtube-dl
sleep 2;
echo -e "\\n"
echo "+++ Installation completed successfully +++"
echo "+++ You can Now use Youtube-dl to download the Youtube Videos +++"
@mskian
Copy link
Author

mskian commented Sep 18, 2018

Open Termux and execute this cURL Command

curl -sL https://gist.githubusercontent.com/mskian/6ea9c2b32d5f41867e7cafc88d1b26d5/raw/youtube-dl.sh | bash

@rewida17
Copy link

rewida17 commented Dec 5, 2018

I think we should run "termux-fix-shebang" after all jobs :)

@mskian
Copy link
Author

mskian commented Feb 25, 2019

@rewida17 Yes Now we can Install termux-exec to resolve this issues - https://wiki.termux.com/wiki/Termux-exec

@filisko
Copy link

filisko commented Mar 23, 2019

@mskian curl is missing.

echo -e "+++ Install curl +++"
echo -e "\\n"

pkg install curl -y

sleep 2;

@mskian
Copy link
Author

mskian commented May 29, 2019

@mskian curl is missing.

echo -e "+++ Install curl +++"
echo -e "\\n"

pkg install curl -y

sleep 2;

Thanks, Updated

@SHMAUS-Carter
Copy link

Handy script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment