import yt_dlp



videos = {
    "سن Pâtissier célébrités : الثلاثاء 28 مارس 2023": "https://www.youtube.com/watch?v=okdKnoU1Bo8&pp=ygUYYWhzYW4gcGF0ZXNzaWVhciAybSAyMDIz",
    "حسن Pâtissier célébrités : الثلاثاء 11 أبريل 2023": "https://www.youtube.com/watch?v=3PtBrBwGjbw&pp=ygUYYWhzYW4gcGF0ZXNzaWVhciAybSAyMDIz",
    # "": "https://www.youtube.com/watch?v=QW1LCfuy5rc&pp=ygUYYWhzYW4gcGF0ZXNzaWVhciAybSAyMDIz"
}

def download_video(url, output_path):
    # Create a YouTubeDL instance
    ydl_opts = {
        'format': 'bestvideo+bestaudio/best',
        'outtmpl': f"{output_path}"+'/%(title)s.%(ext)s',
        'ignoreerrors': True,
        'playliststart': 1,
        'playlistend': 40  # Change this value to download more or fewer videos from the playlist
        }
    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        ydl.download([url])

if __name__ == "__main__":
    for title,url in videos.items():
        download_video(url=url,output_path="Ahsann_Pâtissier")




