-
Notifications
You must be signed in to change notification settings - Fork 5
/
termux-url-opener
50 lines (46 loc) · 1.48 KB
/
termux-url-opener
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/data/data/com.termux/files/usr/bin/bash
# Get the URL
URL=$1
echo "Opening URL"
# Cheks if its Youtube or Spotify URL and downloads it
if [[ $URL == *"open.spotify.com"* ]] ; then
echo "Spotify link detected"
if [[ $URL == *"playlist"* ]]; then
echo "Downloading Playlist"
spotdl --playlist $URL --write-to playlist.txt
spotdl --list playlist.txt
rm -rf playlist.txt
fi
if [[ $URL == *"track"* ]]; then
echo "Downloading Song"
spotdl --song $URL
fi
if [[ $URL == *"album"* ]]; then
echo "Downloading Album"
spotdl --album $URL --write-to album.txt
spotdl --list album.txt
rm -rf album.txt
fi
elif [[ $URL == *"youtu.be"* || $URL == *"youtube.com"* ]]; then
formatvar=0
read -p $'What do you want to download \n(Select the number and press enter) \n 1) Video \n 2) Audio \n' formatvar
if [[ $formatvar == 1 ]]; then
read -p $'Do you want to download the subtitles for this video? \n(Select the number and press enter) \n 1) Yes \n 2) No \n' formatvar
if [[ $formatvar == 1 ]]; then
echo 'Downloading Video with subtitles'
youtube-dl --all-subs $URL
elif [[ $formatvar == 2 ]]; then
echo 'Downloading Video'
youtube-dl $URL
fi
elif [[ $formatvar == 2 ]]; then
echo 'downloading Audio'
youtube-dl -x --audio-format 'mp3' $URL
else
echo 'Default downloading Video'
youtube-dl $URL
fi
else
echo "No downloader for this URL type"
fi
read -n 1 -s -p "Press any key to exit..."