-
Notifications
You must be signed in to change notification settings - Fork 1
/
termux-url-opener
375 lines (204 loc) · 4.95 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
URL=$1
LOCATION="$HOME/storage/shared/MY-MUSIC"
while :
do
echo "CHOOSE A OPTION "
echo "
0) QUIT/EXIT
1) VIDEO + AUDIO
2) VIDEO ONLY
3) AUDIO ONLY
4) CUT AND SAVE
5) CUT AND SAVE AUDIO ONLY
6) ADD CUSTOM ARGS TO YOUTUBE-DL
7) ADD CUSTOM ARGS TO FFMPEG
8) DOWNLOAD WITH SUBS
" && Video="$(yt-dlp --get-filename -o '%(title)s by %(uploader)s' "$URL")"
echo "
$Video
"
read -p "OPTION [DEFAULT=1] : " OPTION
case ${OPTION:=1} in
0) echo "EXITTING"
sleep 1
exit;;
1) echo "
VIDEO + AUDIO
"
echo "Tell Me The Quality You Want To Download The Video In
"
echo "e.g. 1080 720 480 360 240 144
"
read -p 'QUALITY (DEFAULT=1080) : ' QUALITY
echo "
Now Tell Me What You Want To Tag To The Name Of The Video
"
read -p "TAG : " TAG
echo "
Now Commencing Download
"
yt-dlp -f "bestvideo[height<=${QUALITY:=1080}][ext=mp4]+bestaudio[ext=m4a]/bestvideo[height<=$QUALITY]+bestaudio/best[height<=$QUALITY]/best" --add-metadata --embed-thumbnail --recode-video mp4 -o "$LOCATION/%(title)s [$TAG].%(ext)s" "$URL"
exit;;
2) echo "
VIDEO ONLY
"
echo "Tell Me The Quality You Want To Download The Video In
"
echo "e.g. 1080 720 480 360 240 144
"
read -p 'QUALITY (DEFAULT=1080) : ' QUALITY
echo "
Now Tell Me What You Want To Tag To The Name Of The Video
"
read -p "TAG : " TAG
echo "
Now Commencing Download
"
title=$(yt-dlp --get-title $URL)
yt-dlp -f "bestvideo[height<=${QUALITY:=1080}][ext=mp4]/bestvideo[height<=$QUALITY]/best[height<=$QUALITY]/best" --add-metadata --embed-thumbnail --recode-video mp4 -o "$LOCATION/%(title)s [$TAG].%(ext)s" "$URL"
exit;;
3) echo "
AUDIO ONLY
"
echo "
Now Tell Me What You Want To Tag To The Name Of The Video
"
read -p "TAG (NO SPACE's) : " TAG
echo "
Now Commencing Download
"
title=$(yt-dlp --get-title $URL)
yt-dlp --add-metadata -x --audio-format mp3 -o "$LOCATION/%(title)s "[$TAG]".%(ext)s" $URL
exit;;
4) echo "
CUT AND SAVE
"
echo "
Tell Me The Quality You Want To Download The Video In
"
echo "e.g. 1080 720 480 360 240 144
"
read -p 'QUALITY (DEFAULT=1080) : ' QUALITY
echo "
Now Tell Me What You Want To Name The Video
"
echo "And To Help You This Is The Original Video Title And It's Also The default Name"
echo "
$Video
"
read -p 'NAME: ' TAG
Name=$(echo ${TAG:=$Video})
echo "
Examples: 3:15:30.500 = 3 hours 15 mins 30 secs 500 milliseconds
6:15.300 = 6 min 15 sec 300 milliseconds
4 = 4 sec
"
echo "
Now Give Me The Start Time
"
read -p 'HH:MM:SS.MLS : ' STARTTIME
echo "
Now Give Me The END Time
"
read -p 'HH:MM:SS.MLS : ' ENDTIME
echo "
Now Commencing Download
"
cd
video=$(yt-dlp -g -f "bestvideo[height<="${QUALITY:=1080}]/bestvideo/best"" "$URL")
audio=$(yt-dlp -g -f "bestaudio/best" "$URL")
filename="$Name"
echo "$filename
"
ffmpeg -i $video -i $audio -ss $STARTTIME -to $ENDTIME -c copy rename-me.mkv
ffmpeg -i rename-me.mkv rename-me.mp4
rm rename-me.mkv
mv rename-me.mp4 "$LOCATION"/"$filename".mp4
exit;;
5) echo "
CUT AND SAVE AUDIO ONLY
"
echo "
Now Tell Me What You Want To Name The Video
"
echo "
And To Help You This Is The Original Video Title
"
echo $(yt-dlp --get-title "$URL")
read -p 'NAME: ' TAG
Name=$(echo ${TAG:=$Video})
echo "
Examples: 3:15:30.500 = 3 hours 15 mins 30 secs 500 millisecs
6:15.300 = 6 min 15 sec 300 millisecs
4 = 4 sec
"
echo "
Now Give Me The Start Time
"
read -p 'HH:MM:SS.MLS : ' STARTTIME
echo "
Now Give Me The END Time
"
read -p 'HH:MM:SS.MLS : ' ENDTIME
echo "
Now Commencing Download"
audio=$(yt-dlp -g -f "bestaudio/best" "$URL")
title=$(yt-dlp --get-title "$URL")
filename="$Name"
ffmpeg -i "$audio" -ss $STARTTIME -to $ENDTIME -c copy rename-me.mkv
ffmpeg -i rename-me.mkv rename-me.mp3
rm rename-me.mkv
mv ~/rename-me.mp3 "$LOCATION"/"$filename".mp3
exit;;
6) echo "
CUSTOM ARGS
"
echo "
Now Tell Me What Arguments You Want To Add
"
read -p "Add Your Arguments : " ARGS
echo "
Now Commencing Download
"
title=$(yt-dlp --get-title $URL)
echo yt-dlp $ARGS $URL
echo ""
yt-dlp $ARGS $URL
echo"";;
7) echo "
CUSTOM ARGS
"
echo "
Now Tell Me What Arguments You Want To Add
"
read -p "Add Your Arguments : " ARGS
echo "
Now Commencing Download
"
cd "$LOCATION"
echo "ffmpeg -i "$URL" $ARGS"
ffmpeg -i "$URL" $ARGS;;
8) echo "
Download With Subs
"
echo "
Tell Me The Quality You Want To Download The Video In
"
echo "e.g. 1080 720 480 360 240 144
"
read -p 'QUALITY [DEFAULT = 1080] : ' QUALITY
youtube-dl --list-subs "$URL"
echo ""
echo "Ex: en ru"
echo ""
read -p "Choose Subs Language From Above list : " LANG
echo ""
read -p "TAG : " TAG
yt-dlp --write-sub --convert-subs srt --sub-lang "$LANG" -f "bestvideo[height<=${QUALITY:=720}][ext=mp4]+bestaudio[ext=m4a]/bestvideo[height<=$QUALITY]+bestaudio/best[height<=$QUALITY]/best" --add-metadata -o "$LOCATION/%(title)s [$TAG] $CREATOR.%(ext)s" $URL
exit;;
*) clear
echo "
THATS NOT AN OPTION PLEASE TRY AGAIN
";;
esac
done