-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyt-dlp_script.sh
More file actions
71 lines (56 loc) · 1.61 KB
/
yt-dlp_script.sh
File metadata and controls
71 lines (56 loc) · 1.61 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
cd ~/Downloads || echo "$HOME/Downloads directory doesn't exist"
toilet yt-dlp script -w 100 --metal --filter border
blueText() {
reset="\033[0m"
blue="\033[1;34m"
echo "$blue$1$reset"
}
printf "%s" "$(blueText "Do you want to download a playlist? [n/y]: ")"
read -r isPlaylist
split=""
if [ "$isPlaylist" = "y" ] || [ "$isPlaylist" = "Y" ]; then
printf "%s" "$(blueText "\n1: download certain videos\n2: download the full playlist (default)\nyour choice : ")"
read -r pChoice
else
printf "%s" "$(blueText "\nDo you want to split chapters? [n/y]: ")"
read -r split
fi
if [ "$split" = "y" ] || [ "$split" = "Y" ]; then
split="--split-chapters"
fi
printf "%s" "
$(blueText "url: ")"
read -r url
toDownload=""
case $pChoice in
1)
printf "%s" "$(blueText "\nthe videos in the format [ eg: 1,3-7,13 ] : ")"
read -r pVideos
toDownload="--playlist-items=$pVideos"
;;
*) ;;
esac
trap 'trap - INT' INT
printf "%s" "$(blueText "
download options:-
1: all (default)
2: audio only
3: video only
4: full
your choice : ")"
read -r choice
case $choice in
2) yt-dlp -F "$toDownload" "$url" | sed '/images/d;/audio\ only/d;/video\ only/d;/^\[youtube/d;/^\[info/d' ;;
3) yt-dlp -F "$toDownload" "$url" | grep -i 'audio only\|^\[download' ;;
4) yt-dlp -F "$toDownload" "$url" | grep -i 'video only\|^\[download' ;;
*) yt-dlp -F "$toDownload" "$url" ;;
esac
trap - INT
printf "%s" "$(blueText "\nyour chosen ID : ")"
read -r quality
case $isPlaylist in
y | Y) yt-dlp -f "$quality" -o "%(playlist_index)02d - %(title)s.%(ext)s" "$toDownload" "$url" ;;
*) yt-dlp "$split" -f "$quality" "$url" ;;
esac
notify-send "download completed"