浏览代码

[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).
Jaime Marquínez Ferrándiz 9 年之前
父节点
当前提交
3c91e41614
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      youtube_dl/downloader/fragment.py

+ 1 - 1
youtube_dl/downloader/fragment.py

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