1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[downloader/fragment] Don't fail if the 'Content-Length' header is missing

In some dailymotion videos (like http://www.dailymotion.com/video/x3k0dtv from #8156) the segments URLs don't have the 'Content-Length' header and HttpFD sets the 'totat_bytes' field to None, so we also use '0' in that case (since we do different math operations with it).
This commit is contained in:
Jaime Marquínez Ferrándiz 2016-01-10 14:32:53 +01:00
parent 7e8a800f29
commit 3c91e41614

View file

@ -66,7 +66,7 @@ class FragmentFD(FileDownloader):
if s['status'] not in ('downloading', 'finished'): if s['status'] not in ('downloading', 'finished'):
return return
frag_total_bytes = s.get('total_bytes', 0) frag_total_bytes = s.get('total_bytes') or 0
if s['status'] == 'finished': if s['status'] == 'finished':
state['downloaded_bytes'] += frag_total_bytes state['downloaded_bytes'] += frag_total_bytes
state['frag_index'] += 1 state['frag_index'] += 1