forked from DRMTalks/devine
Remove 5-attempt loop from DASH and HLS Downloads
These are unnecessary now as all downloaders have retry functionality built-in.
This commit is contained in:
parent
cc4900a2ed
commit
e8e3d4a90f
|
@ -519,9 +519,6 @@ class DASH:
|
||||||
if DOWNLOAD_CANCELLED.is_set():
|
if DOWNLOAD_CANCELLED.is_set():
|
||||||
raise KeyboardInterrupt()
|
raise KeyboardInterrupt()
|
||||||
|
|
||||||
attempts = 1
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
if bytes_range:
|
if bytes_range:
|
||||||
# aria2(c) doesn't support byte ranges, use python-requests
|
# aria2(c) doesn't support byte ranges, use python-requests
|
||||||
downloader_ = requests_downloader
|
downloader_ = requests_downloader
|
||||||
|
@ -529,6 +526,7 @@ class DASH:
|
||||||
else:
|
else:
|
||||||
downloader_ = downloader
|
downloader_ = downloader
|
||||||
headers_ = headers
|
headers_ = headers
|
||||||
|
|
||||||
downloader_(
|
downloader_(
|
||||||
uri=url,
|
uri=url,
|
||||||
out=out_path,
|
out=out_path,
|
||||||
|
@ -537,12 +535,6 @@ class DASH:
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
segmented=True
|
segmented=True
|
||||||
)
|
)
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
if DOWNLOAD_CANCELLED.is_set() or attempts == 5:
|
|
||||||
raise e
|
|
||||||
time.sleep(2)
|
|
||||||
attempts += 1
|
|
||||||
|
|
||||||
# fix audio decryption on ATVP by fixing the sample description index
|
# fix audio decryption on ATVP by fixing the sample description index
|
||||||
# TODO: Should this be done in the video data or the init data?
|
# TODO: Should this be done in the video data or the init data?
|
||||||
|
|
|
@ -422,9 +422,6 @@ class HLS:
|
||||||
if DOWNLOAD_LICENCE_ONLY.is_set():
|
if DOWNLOAD_LICENCE_ONLY.is_set():
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
attempts = 1
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
headers_ = session.headers
|
headers_ = session.headers
|
||||||
if segment.byterange:
|
if segment.byterange:
|
||||||
# aria2(c) doesn't support byte ranges, use python-requests
|
# aria2(c) doesn't support byte ranges, use python-requests
|
||||||
|
@ -435,6 +432,7 @@ class HLS:
|
||||||
headers_["Range"] = f"bytes={byte_range}"
|
headers_["Range"] = f"bytes={byte_range}"
|
||||||
else:
|
else:
|
||||||
downloader_ = downloader
|
downloader_ = downloader
|
||||||
|
|
||||||
downloader_(
|
downloader_(
|
||||||
uri=urljoin(segment.base_uri, segment.uri),
|
uri=urljoin(segment.base_uri, segment.uri),
|
||||||
out=out_path,
|
out=out_path,
|
||||||
|
@ -443,12 +441,6 @@ class HLS:
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
segmented=True
|
segmented=True
|
||||||
)
|
)
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
if DOWNLOAD_CANCELLED.is_set() or attempts == 5:
|
|
||||||
raise e
|
|
||||||
time.sleep(2)
|
|
||||||
attempts += 1
|
|
||||||
|
|
||||||
download_size = out_path.stat().st_size
|
download_size = out_path.stat().st_size
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue