[youtube] remove streams without contentLength (fix #2767)

This commit is contained in:
Mort Yao 2020-01-13 22:16:33 +01:00
parent 5943fb6ca3
commit c3ae61c04e
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -451,6 +451,8 @@ class YouTube(VideoExtractor):
for afmt in video_info['adaptive_fmts'][0].split(',')]
else:
streams = json.loads(video_info['player_response'][0])['streamingData']['adaptiveFormats']
# streams without contentLength got broken urls, just remove them (#2767)
streams = [stream for stream in streams if 'contentLength' in stream]
for stream in streams:
stream['itag'] = str(stream['itag'])
if 'qualityLabel' in stream: