Created
April 8, 2021 21:09
-
-
Save tomfleet/55292cd60fe3ec6a0de6a2ca007f95c0 to your computer and use it in GitHub Desktop.
yta.sh
This file contains hidden or 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 | |
| # Ask the user for login details | |
| read -p 'YouTubeMusic Link: ' uservar | |
| read -p 'Artist? - Leave Blank to auto... ' foldName | |
| if [-z $foldName] | |
| then | |
| echo "No Artist Supplied, will guess..." | |
| foldName="%(artist)s" | |
| baseLocation="/media/sf_Music/%(artist)s/" | |
| echo "${baseLocation}" | |
| else | |
| echo "Artist Supplied = $foldName" | |
| baseLocation="/media/sf_Music/"${foldName}"/" | |
| echo ${baseLocation} | |
| fi | |
| baseLink=${uservar%%\&*} | |
| echo baselink = $baseLink | |
| listID=$(echo $baseLink | cut -d'=' -f 2) | |
| echo listID = $listID | |
| listURL=$(echo $baseLink | cut -d'=' -f 1) | |
| echo listURL = $listURL | |
| #direc=$(echo "'home/tom/Music/${foldName}/%playlist_index)s.%(ext)s'") | |
| #baseLocation='~/Music/%(playlist_title)s/' | |
| index='%(playlist_index)s - ' | |
| fileName='%(artist)s - %(track)s' | |
| outputExt='%(ext)s' | |
| outputPath=$baseLocation$index$fileName | |
| outputFile=$outputPath.$outputExt | |
| echo $outputFile | |
| #echo "Target = $direc" | |
| # | |
| #if [-z $foldName] | |
| #then | |
| # echo "" | |
| youtube-dl -u tomfleet@gmail.com -p hunter2 -x -f 'best' --recode-video 'mp4' --audio-quality 0 --embed-thumbnail --cookies | |
| "~/youtube.com_cookies.txt" --autonumber-start 1 --yes-playlist -o "${baseLocation}""%(album)s/%(playlist_index)s - %(artist)s - | |
| %(track)s.%(ext)s" --exec "ffmpeg -i {} -codec:a libmp3lame -qscale:a 0 {}.mp3 && rm {}" $baseLink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment