[downloader/fragment] Don't fail if the 'Content-Length' header is missing
[youtube-dl] / youtube_dl / downloader / fragment.py
index 5f9d6796dc80d53105c4c776ab4ecaaad391af36..3da554622e77c072427cac997f9acf7f785671dc 100644 (file)
@@ -35,6 +35,7 @@ class FragmentFD(FileDownloader):
                 'quiet': True,
                 'noprogress': True,
                 'ratelimit': self.params.get('ratelimit', None),
+                'retries': self.params.get('retries', 0),
                 'test': self.params.get('test', False),
             }
         )
@@ -65,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