我正在尝试使用 youtube-dl 从 youtube 中的播放列表列表中获取一些信息。我已经编写了这段代码,但它需要的不是视频信息而是播放列表信息(例如播放列表标题而不是播放列表中的视频标题)。我不明白为什么。
input_file = open("url")
for video in input_file:
print(video)
ydl_opts = {
'ignoreerrors': True
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
info_dict = ydl.extract_info(video, download=False)
for i in info_dict:
video_thumbnail = info_dict.get("thumbnail"),
video_id = info_dict.get("id"),
video_title = info_dict.get("title"),
video_description = info_dict.get("description"),
video_duration = info_dict.get("duration")
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。