import yt_dlp
def download_video(url):
# yt-dlp 옵션 설정
ydl_opts = {
'outtmpl': '%(title)s.%(ext)s', # 파일 이름 형식 (제목과 확장자로 저장)
'format': 'best', # 가장 좋은 품질로 다운로드
}
# yt-dlp 다운로드 수행
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
if __name__ == "__main__":
url = input("다운로드할 URL을 입력하세요: ")
download_video(url)