Last active
April 13, 2020 18:03
-
-
Save hbend1li/da5fcd099b657f545e9b513fa55d5149 to your computer and use it in GitHub Desktop.
Download from soundcloud by using youtube-dl, and generate .m3u playlist file
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
#!/bin/bash | |
if [ "$1" == "upgrade" ]; then | |
sudo pip3 install --upgrade youtube-dl | |
elif [ "$1" ]; then | |
youtube-dl -c -f best --embed-thumbnail --add-metadata -o '%(playlist)s/%(title)s-%(id)s.%(ext)s' $1 | |
PLAYLIST=$(youtube-dl --get-filename -o "%(uploader)s.m3u" $1) | |
echo "#EXTM3U" > "$PLAYLIST" | |
youtube-dl --get-filename -o "#EXTINF:-1,%(title)s\r\n%(playlist)s/%(title)s-%(id)s.%(ext)s" $1 >> "$PLAYLIST" | |
sed -i -e 's/\\r\\n/\r\n/g' "$PLAYLIST" | |
else | |
echo "soundcloud.sh {URL}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment