[downloader/http] Simplify
authorSergey M․ <dstftw@gmail.com>
Sun, 2 Aug 2015 20:25:08 +0000 (02:25 +0600)
committerSergey M․ <dstftw@gmail.com>
Sun, 2 Aug 2015 20:25:08 +0000 (02:25 +0600)
youtube_dl/downloader/http.py

index f796ee1135da582b717771681deccd5b3aa29f38..0862e90bbb0a5bbc5f6414e6907cdc913d0944e6 100644 (file)
@@ -58,20 +58,16 @@ class HttpFD(FileDownloader):
             # Establish connection
             try:
                 data = self.ydl.urlopen(request)
-
                 if resume_len > 0:
                     content_range = data.headers.get('Content-Range')
                     if content_range:
                         content_range_m = re.search(r'bytes (\d+)-', content_range)
-                        if content_range_m:
-                            # Content-Range is correct - go on
-                            if resume_len == int(content_range_m.group(1)):
-                                break
-
+                        # Content-Range is correct - go on
+                    if content_range_m and resume_len == int(content_range_m.group(1)):
+                        break
                     # Content-Range is invalid - wipe the file and do entire redownload
                     resume_len = 0
                     open_mode = 'wb'
-
                 break
             except (compat_urllib_error.HTTPError, ) as err:
                 if (err.code < 500 or err.code >= 600) and err.code != 416: