sed '^/ytsearch1:/' <urlikes.tsv
<<fin cat > ~/yt-dlp.conf
--max-filesize 400M
# don't download the full playlist if the link is one
--no-playlist
# our lil list of file
-a /tmp/l
# just some formating
-o ~/Music/%(title)s%(channel)s.%(ext)s
# to test and not launch the command
--simulate
# extract audio
-x
# audio formating
--audio-format mp3
--audio-quality 4
--embed-thumbnail
--embed-metadata
-t mp3
fin
yt-dlp -P ~/yt-dlp.conf
First use any service to extract ur likes from Spotify. If you’re looking to dl a playlist, it’s quite easy
w3m -dump "urPlaylist" | vim -
# in vim :
:g/\[.*/d → delete lines with spotify ids
:g/^$/d → delete empty lines
Then manually transform each line into song - artist. Or have fun with sed or awk :)
Now when you have your list of songs we can go to next steps
Basically we have 2 steps:
we’re gonna build a tsv and here’s what we have:
Track name Artist name Album
Tell me I never knew that caroline Tell me I never knew that
Wild World Yusuf / Cat Stevens Tea For The Tillerman (Remastered 2020)
Headlock Imogen Heap Speak for Yourself
Bluest Flame Selena Gomez I Said I Love You First
Art School Frankie Cosmos Zentropy
Carol Of The Bells Lindsey Stirling Warmer In The Winter (Deluxe Edition)
Not Done Begging (Yet) Leisure Hour jenny
jenny - acoustic demo Leisure Hour jenny (acoustic demo)
Blues d’hiver Theodora Blues d’hiver
…
first I’m intrigued if having one long command is faster than launching N commands (one for each entry)
$ time yt-dlp ytsearch1:"wild world Cat stevens" --get-id --get-title --skip-download
yt-dlp ytsearch1:"wild world Cat stevens" --get-id --get-title --skip-downloa 6.41s user 0.37s system 78% cpu 8.680 total
yt-dlp ytsearch1:"blues flame Selena Gomez" --get-id --get-title 5.95s user 0.25s system 75% cpu 8.213 total
when :
yt-dlp ytsearch1:"wild world Cat stevens" "ytsearch1:bluesflame Selena Gomez" 9.51s user 0.35s system 73% cpu 13.476 total
So it’s gonna be one huge command with xargs
yt-dlp ytsearch1:"rihanna diamond" --default-search ytsearch --no-playlist --no-check-certificate --geo-bypass --flat-playlist --skip-download --quiet --ignore-errors --get-id --get-title
<~/likesSpotify.liste.tsv cut -f-2 | sed -n '2,$p' |
xargs -d'\n' printf 'ytsearch1:"%s" \n' > /tmp/l
!careful in vim the max-args are low, for this command to work, you need to be in your shell
Ok so after a few tries, here a simple solution. In vim or with sed add in front of the tsv with only title \t artist : “ytsearch1:”. In order that each line looks like that.
ytsearch1:Headlock Imogen Heap
then your command will be :
$ yt-dlp -a $YOURPLAYLISTFILE --default-search ytsearch --no-playlist --no-check-certificate --geo-bypass --flat-playlist --skip-download --quiet --ignore-errors --get-id --get-title | tee /tmp/liste2
the -a option take a file as stdin where each line is a url, and our lil yt search count as one. What works well is that we only launch one yt-dlp process and thus gaining a lot of time ( no n forks ).
So, in the end, we just had to add the “ytsearch1” and this first part was done. Now we juste have to browse throung the man page of yt-dlp to get the right option for the download
Let’s look for the option
<<fin cat > ~/yt-dlp.conf
--max-filesize 400M
# don't download the full playlist if the link is one
--no-playlist
# our lil list of file
-a /tmp/l
# just some formating
-o ~/Music/%(title)s%(channel)s.%(ext)s
# to test and not launch the command
--simulate
# extract audio
-x
# audio formating
--audio-format mp3
--audio-quality 4
--embed-thumbnail
--embed-metadata
-t mp3
fin
All in a file call preset so our final command looks sleek:
$ yt-dlp -P ~/yt-dlp.conf
the -P is to indicate where is your conf files and if you were to launch the full dl you could just yt-dlp and it will download the file. I would advise to delete the -a /tmp/l from the config file if you were to use yt-dlp often, or simply rename the file.
Also you might want this option
--abort-on-error
Abort downloading of further videos if an error occurs (Alias:
--no-ignore-errors)
But for now I’m just looking to download the maximum of my music and all the tweaking regarding which files may have been missed or are corrupted in some ways, will be some work for later. Ideally i’d like to check if i’ve already downloaded a song but it’s already enough.
Now I’ll only mpv ~/Music or
find ~/Music -type f | shuf | mpv
And enjoy my likes back. Also I’ll be sometime streaming my music sessions @ : http://bebou.netlib.re:1111/vi.mp3 ; come along 📻 !! And if you too are keen to stream your music session or else please write to us by email or else, we’ll help you !