import yt_dlp
from comtypes.client import CreateObject
import sys
url = input("请输入网址:")
ydl_opts = {
'outtmpl': 'videos/%(title)s.%(ext)s', # 下载的视频将被存储到videos文件夹,文件名为视频标题
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
print("视频下载成功!已保存在videos文件夹中")
实现Python爬虫YouTube视频
于 2024-04-14 00:20:24 首次发布