import os import youtube_dl if __name__ == "__main__": script_dir = os.path.dirname(os.path.abspath(__file__)) ydl = youtube_dl.YoutubeDL( { "format": "bestaudio/best", "postprocessors": [ {"key": "FFmpegExtractAudio", "preferredcodec": "vorbis"} ], "outtmpl": f"{script_dir}/songs/%(title)s.ogg", "ignoreerrors": True, "restrictfilenames": True, } ) playlist_infos = ydl.extract_info( "https://www.youtube.com/playlist?list=PLQC73oq6JtgyYNOeifrJXXzZ1-F0Kgmbg", )