mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-04 20:17:22 +01:00
[fragment] Fix range header when using -N
and media sequence (#1048)
Authored by: shirt
This commit is contained in:
parent
daf7ac2b92
commit
d9d8b85747
@ -332,7 +332,7 @@ def download_and_append_fragments(self, ctx, fragments, info_dict, *, pack_func=
|
||||
|
||||
def download_fragment(fragment, ctx):
|
||||
frag_index = ctx['fragment_index'] = fragment['frag_index']
|
||||
headers = info_dict.get('http_headers', {})
|
||||
headers = info_dict.get('http_headers', {}).copy()
|
||||
byte_range = fragment.get('byte_range')
|
||||
if byte_range:
|
||||
headers['Range'] = 'bytes=%d-%d' % (byte_range['start'], byte_range['end'] - 1)
|
||||
|
@ -167,6 +167,7 @@ def is_ad_fragment_end(s):
|
||||
'byte_range': byte_range,
|
||||
'media_sequence': media_sequence,
|
||||
})
|
||||
media_sequence += 1
|
||||
|
||||
elif line.startswith('#EXT-X-MAP'):
|
||||
if format_index and discontinuity_count != format_index:
|
||||
@ -191,6 +192,7 @@ def is_ad_fragment_end(s):
|
||||
'byte_range': byte_range,
|
||||
'media_sequence': media_sequence
|
||||
})
|
||||
media_sequence += 1
|
||||
|
||||
if map_info.get('BYTERANGE'):
|
||||
splitted_byte_range = map_info.get('BYTERANGE').split('@')
|
||||
|
Loading…
Reference in New Issue
Block a user