如何使用youtube-dl从播放列表中打印单个视频网址?

时间:2019-06-06 21:36:59

标签: python python-3.x youtube youtube-dl

我有一个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']的值。下载播放列表时,有什么方法可以做到这一点?

0 个答案:

没有答案