Last active
January 3, 2022 09:04
-
-
Save Ehsanul-Karim-Pappu/7384a3c3f102cef48329d27f9f3afa00 to your computer and use it in GitHub Desktop.
This is a termux-url-opener script to do diffrent tasks on my Android phone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/data/data/com.termux/files/usr/bin/zsh | |
# | |
# This is a termux-url-opener script to do diffrent tasks on my Android phone | |
# | |
# | |
# | |
# How to use this script | |
############################# | |
# Create the bin directory | |
# ➜ ~ mkdir bin | |
# ➜ ~ cd bin | |
# Create the script (copy & paste) I used vim. Use your prefered editor | |
# ➜ vim termux-url-opener | |
# | |
# Make it executable | |
# ➜ chmod +x termux-url-opener | |
# | |
# Install zsh wget and ffmpeg | |
# ➜ pkg install zsh wget ffmpeg python | |
# https://wiki.termux.com/wiki/Shells | |
# | |
# Install youtube_dl with pip | |
# ➜ pip install youtube_dl youtube_dlc | |
# | |
# run the following command to enable the termux storage features | |
# ➜ termux-setup-storage | |
# https://wiki.termux.com/wiki/Termux-setup-storage | |
url=$1 | |
echo "Want to see the formates? (y/n)" | |
read ans | |
case $ans in | |
y) | |
youtube-dlc -F $url | |
echo "Enter the formate code of which formate you want to download" | |
read fid | |
;; | |
Y) | |
youtube-dlc -F $url | |
echo "Enter the formate code of which formate you want to download" | |
read fid | |
;; | |
n) | |
echo "Enter the formate code of which formate you want to download" | |
read fid | |
;; | |
N) | |
echo "Enter the formate code of which formate you want to download" | |
read fid | |
;; | |
esac | |
echo "What should I do with $url ?" | |
echo "v) download youtube video to movies-folder" | |
echo "m) download youtube video and convert it to mp3 (music-folder)" | |
echo "p) download youtube playlist?" | |
echo "w) wget file to download-folder" | |
echo "x) nothing" | |
read CHOICE | |
case $CHOICE in | |
v) | |
youtube-dlc -f $fid -o "/storage/emulated/0/Movies/%(title)s.%(ext)s" $url | |
echo "Saved in /storage/emulated/0/Movies" | |
;; | |
m) | |
echo "Artist" | |
read artist | |
echo "Title" | |
read title | |
echo "Album" | |
read album | |
youtube-dlc --extract-audio --audio-format mp3 --output "/storage/emulated/0/Music/%(title)s.%(ext)s" $url | |
mid3v2 -a $artist -t $title -A $album /storage/emulated/0/Music/%(title)s.mp3 | |
echo "Saved in /storage/emulated/0/Music" | |
;; | |
p) | |
echo "Create a new folder" | |
read folder | |
youtube-dlc -f $fid -o "/storage/emulated/0/$folder/%(title)s.%(ext)s" $url | |
echo "Saved in /storage/emulated/0/$folder" | |
;; | |
w) | |
cd ~/storage/downloads | |
wget $url | |
;; | |
x) | |
echo "bye" | |
;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment