PYTHON Download YOUTUBE

Step 01 : Install module

pip install yt_dlp

Step 02 : Code python app.py

import yt_dlp

url = input("Enter the YouTube video URL: ")

ydl_opts = {
    'format': 'best',
    'outtmpl': '%(title)s.%(ext)s',  # Save as video title
}

with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])

print("Download completed!")

Step 03 : RUN

python app.py

อ้างอิง

https://yt-dlp.eknerd.com/docs/embedding%20yt-dlp/using-yt-dlp-in-python-scripts

https://pypi.org/project/yt-dlp

Share

You may also like...

Leave a Reply