radio-bullshit/yt_sync.py

33 lines
980 B
Python
Raw Normal View History

#!/usr/bin/python3
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__))
# Radio Bullshit
## parameters for Radio Bullshit playlist
ydl_parameters = {
"format": "bestaudio/best",
"postprocessors": [{"key": "FFmpegExtractAudio", "preferredcodec": "vorbis"}],
"outtmpl": f"{script_dir}/songs/%(title)s.ogg",
"ignoreerrors": True,
"restrictfilenames": True,
}
## download
ydl = youtube_dl.YoutubeDL(ydl_parameters)
ydl.extract_info(
2021-06-05 22:34:59 +00:00
"https://www.youtube.com/playlist?list=PLQC73oq6JtgyYNOeifrJXXzZ1-F0Kgmbg",
)
# Radio Bullshit Jingles
## change output path for Radio Bullshit jingles
ydl_parameters["outtmpl"] = f"{script_dir}/jingles/%(title)s.ogg"
## download
ydl = youtube_dl.YoutubeDL(ydl_parameters)
ydl.extract_info(
"https://www.youtube.com/playlist?list=PLQC73oq6JtgzX8zbHtP5qXKiH6cuanFWi"
)