radio-bullshit/yt_sync.py

23 lines
600 B
Python
Raw Normal View History

2021-06-05 22:34:59 +00:00
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",
)