forked from sayan01/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdown
executable file
·31 lines (28 loc) · 811 Bytes
/
mdown
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
#!/bin/bash
# Download music from youtube/other platforms using yt-dl
# set the name to be the second parameter if provided.
# dont give any extension to the output name, if you want to specify
# a different audio format, give it as third parameter.
# providing format without name is not allowed
# Usage:
# mdown https://www.youtube.com/watch?v=dQw4w9WgXcQ
# mdown https://www.youtube.com/watch?v=dQw4w9WgXcQ music
# mdown https://www.youtube.com/watch?v=dQw4w9WgXcQ music opus
link=$1
name=$2
format=$3
if [ "$1" == "" ]; then
echo "Usage:
mdown link
mdown link name
mdown link name format" ; exit 1
fi
if [ "$2" == "" ]; then
name="%(title)s-%(id)s"
fi
if [ "$3" == "" ]; then
format="mp3"
fi
youtube-dl -x --audio-format $format \
--embed-thumbnail --add-metadata \
"$link" -o "$name.%(ext)s"