Skip to content

Instantly share code, notes, and snippets.

@gfrn
Created July 22, 2021 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfrn/0a3ea8f3a4a6cc0fa4c7e90b1b17ae12 to your computer and use it in GitHub Desktop.
Save gfrn/0a3ea8f3a4a6cc0fa4c7e90b1b17ae12 to your computer and use it in GitHub Desktop.
Download all songs from a spotdl output file using youtube-dl
import ast
import youtube_dl
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with open("test", 'r') as file:
videos = ast.literal_eval(file.read())
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([video["youtubeLink"] for video in videos])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment