mirror of
https://github.com/pvlnes/homelab.git
synced 2026-04-05 19:51:46 +00:00
22 lines
447 B
Python
22 lines
447 B
Python
import yt_dlp
|
|
import os
|
|
|
|
PLAYLIST_URL = os.environ["VK_PLAYLIST_URL"]
|
|
|
|
def get_playlist_videos():
|
|
ydl_opts = {
|
|
"extract_flat": True,
|
|
"quiet": True,
|
|
"skip_download": True,
|
|
}
|
|
|
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
info = ydl.extract_info(PLAYLIST_URL, download=False)
|
|
|
|
videos = {}
|
|
for entry in info["entries"]:
|
|
if entry:
|
|
videos[entry["id"]] = entry["url"]
|
|
|
|
return videos
|