我有一个Python脚本,可以使用youtube-dl下载YouTube播放列表。每当程序遇到被阻止或审查的视频时,它都会显示以下错误:
library(gplots)
y <- c(2009, 2010, 2011, 2012, 2013, 2014, 2015)
B <- c(249.3543, 249.5647, 392.4330, 383.8343 ,289.9862, 541.6652 ,415.5451)
StdB <- c(64.61869, 59.60757, 46.54578 ,55.59268 ,51.16547 ,59.10967 ,58.53109)
plotCI(y, B, StdB, StdB,
sfrac = 0.01, gap=0.2, type="p",lwd=2.5,xlab='Years',ylab ='Values')
或
ERROR: This video can't be played here, but you can still watch it on YouTube. Watch on YouTube
但是,我还需要它来打印特定视频的URL,以便知道丢失的视频。无需编辑youtube.py提取程序是否可以实现这一目标?
编辑: 澄清:目前,我通过修改extractor / youtube.py中第2075行的代码(将其更改为
)来“解决”了我的问题ERROR: This video contains content from I-Media Production (CLA), who has blocked it on copyright grounds.
到
else:
error_message = clean_html(video_info.get('reason', [None])[0])
if not error_message:
error_message = extract_unavailable_message()
if error_message:
raise ExtractorError(error_message, expected=True)
raise ExtractorError('no conn, hlsvp, hlsManifestUrl or url_encoded_fmt_stream_map information found in video info')
但是我希望能够在不触摸youtube.py的情况下获取video_info ['video_id']的值。下载播放列表时,有什么方法可以做到这一点?