aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader/dash.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/downloader/dash.py')
-rw-r--r--youtube_dl/downloader/dash.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/youtube_dl/downloader/dash.py b/youtube_dl/downloader/dash.py
index c6d674bc6..cc30485f8 100644
--- a/youtube_dl/downloader/dash.py
+++ b/youtube_dl/downloader/dash.py
@@ -38,8 +38,7 @@ class DashSegmentsFD(FragmentFD):
# In DASH, the first segment contains necessary headers to
# generate a valid MP4 file, so always abort for the first segment
fatal = i == 0 or not skip_unavailable_fragments
- count = 0
- while count <= fragment_retries:
+ for count in range(fragment_retries + 1):
try:
fragment_url = fragment.get('url')
if not fragment_url:
@@ -57,9 +56,8 @@ class DashSegmentsFD(FragmentFD):
# is usually enough) thus allowing to download the whole file successfully.
# To be future-proof we will retry all fragments that fail with any
# HTTP error.
- count += 1
- if count <= fragment_retries:
- self.report_retry_fragment(err, frag_index, count, fragment_retries)
+ if count < fragment_retries:
+ self.report_retry_fragment(err, frag_index, count + 1, fragment_retries)
except DownloadError:
# Don't retry fragment if error occurred during HTTP downloading
# itself since it has own retry settings
@@ -68,7 +66,7 @@ class DashSegmentsFD(FragmentFD):
break
raise
- if count > fragment_retries:
+ if count >= fragment_retries:
if not fatal:
self.report_skip_fragment(frag_index)
continue