mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-04 19:44:33 -04:00
[downloader/fragment] Fix bugs around resuming with Range (#2901)
Authored by: Lesmiscore
This commit is contained in:
committed by
GitHub
parent
195c22840c
commit
93c8410d33
@@ -5252,6 +5252,16 @@ def join_nonempty(*values, delim='-', from_dict=None):
|
||||
return delim.join(map(str, filter(None, values)))
|
||||
|
||||
|
||||
def parse_http_range(range):
|
||||
""" Parse value of "Range" or "Content-Range" HTTP header into tuple. """
|
||||
if not range:
|
||||
return None, None, None
|
||||
crg = re.search(r'bytes[ =](\d+)-(\d+)?(?:/(\d+))?', range)
|
||||
if not crg:
|
||||
return None, None, None
|
||||
return int(crg.group(1)), int_or_none(crg.group(2)), int_or_none(crg.group(3))
|
||||
|
||||
|
||||
class Config:
|
||||
own_args = None
|
||||
filename = None
|
||||
|
Reference in New Issue
Block a user