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
