mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-03 16:48:29 +02:00
[downloader/fragment] Fix bugs around resuming with Range (#2901)
Authored by: Lesmiscore
This commit is contained in:
parent
195c22840c
commit
93c8410d33
3 changed files with 41 additions and 19 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue