Search code examples
listsearchyoutubeyoutube-apiyoutube-dl

Is it possible to make a youtube list out of a text file?


So, I have a text in the form

artist01 - piece01
artist02 - piece02
...

Can I make a youtube list out of that, or at least get a text file like

youtube-url1
youtube-url2
...

Given that each search will return more than one results, I could just take the first result of each one and get the respective video URL.

I'm using Linux (Debian if that matters) and was wondering whether youtube-dl have this function. Or must I use the Youtube API?

Also, could that list with the URLs be made as a youtube list too?


Solution

  • Given a file searches, you can run

    youtube-dl --get-id --default-search ytsearch --batch-file searches > song-ids
    

    song-ids will contain the YouTube video IDs. You can feed them into youtube-dl at a later stage. If you want full URLs, prefix them with https://youtu.be/.