Skip to content

Instantly share code, notes, and snippets.

@pereirawe
Last active May 23, 2020 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pereirawe/8bdd1205e6e2481e3e6d8259d51134ed to your computer and use it in GitHub Desktop.
Save pereirawe/8bdd1205e6e2481e3e6d8259d51134ed to your computer and use it in GitHub Desktop.
#!/bin/bash
clear
bold=$(tput bold)
normal=$(tput sgr0)
echo "${bold}TERMUX MEDIA DOWNLOADER${normal} by @pereirawe\n"
echo $'\n'
echo "> ${1}"
if [[ $1 =~ ^.*youtu.*$ ]]; then
echo $'\nDownload as an mp3 file ? (Y/N/E)'
read -p "> " -n 1 -r
echo $'\n'
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo 'Downloading mp3 file...'
youtube-dl -f 'bestaudio' -o '/data/data/com.termux/files/home/storage/shared/Youtube/Music/%(title)s.f%(format_id)s.%(ext)s' $1
elif [[ $REPLY =~ ^[Nn]$ ]]; then
echo 'Downloading video...'
youtube-dl --no-mtime -o "/data/data/com.termux/files/home/storage/shared/Youtube/Movies/%(title)s.%(ext)s" -f "best[height<=1080]" $1
else
echo "Exiting..."
fi
elif [[ $1 =~ ^.*instagram.*$ ]]; then
echo 'Comming so soon...'
elif [[ $1 =~ ^.*twitter.*$ ]]; then
echo 'Comming soon...'
elif [[ $1 =~ ^.*nourlselected.*$ ]]; then
echo "ERROR1"
else
echo Unhandled URL type: $1
fi
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment