Skip to content

Instantly share code, notes, and snippets.

@toxdes
Last active December 18, 2022 16:12
Show Gist options
  • Save toxdes/947ba6f1c16d646f2591e870f1c9774e to your computer and use it in GitHub Desktop.
Save toxdes/947ba6f1c16d646f2591e870f1c9774e to your computer and use it in GitHub Desktop.
Script to install youtube-dl on termux (android) along with clipboard support
#!/usr/bin/env bash
termux-setup-storage && \
YT_HOME="$HOME/storage/dcim" && \
yes | apt update && \
yes | apt full-upgrade && \
pkg install -y python ffmpeg termux-api && \
pip install --upgrade youtube-dl && \
mkdir -p $YT_HOME && \
mkdir -p $HOME/bin && \
curl https://raw.githubusercontent.com/toxdes/python-scripts/master/youtube.py -o $HOME/../usr/bin/yt && \
chmod a+rx $HOME/../usr/bin/yt && \
echo 'python3 $HOME/../usr/bin/yt -q 1080p -l $1 -o $HOME/storage/dcim' > $HOME/bin/termux-url-opener && \
chmod a+rx $HOME/bin/termux-url-opener && \
echo "---------"
echo -e "\n\nInstalled Successfully. Restart termux,and you're good to go!\n\n"
echo -e "\nYou might need to give \"Draw over other apps\" permission to termux.\n"
echo "---------"
@toxdes
Copy link
Author

toxdes commented Aug 20, 2021

To use this script,

Installation (one time)

  1. Download termux APK from F-Droid since play store version is deprecated.
  2. Open termux, and paste the following command
curl -L https://git.io/J0pdx | bash -
  1. The app will ask for storage access, allow it by tapping on 'Yes'.
  2. Restart termux after installation.

Usage

  1. Tap on share for the video that you wanted to download, and choose termux, download will start automatically. (for this method to work, you might need to give "Draw over other apps" permission to termux.)
  2. OR Just use yt -h and explore the cli to get more sophisticated options.

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