Skip to content

Instantly share code, notes, and snippets.

@procopaeus
Last active March 17, 2023 21:56
Show Gist options
  • Save procopaeus/5c941d785d399a5699851fe1bdce57ce to your computer and use it in GitHub Desktop.
Save procopaeus/5c941d785d399a5699851fe1bdce57ce to your computer and use it in GitHub Desktop.
Script to install youtube-dl on termux (Android) along with clipboard support

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://bit.ly/tmxytdl | 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.
#!/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 yt-dlp && \
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 "---------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment