mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 16:42:57 +01:00
[extractor/youtube] Construct dash formats with range
query
Closes #6369
This commit is contained in:
parent
4d248e29d2
commit
5038f6d713
@ -3776,10 +3776,19 @@ def _extract_formats_and_subtitles(self, streaming_data, video_id, player_url, l
|
|||||||
if no_video:
|
if no_video:
|
||||||
dct['abr'] = tbr
|
dct['abr'] = tbr
|
||||||
if no_audio or no_video:
|
if no_audio or no_video:
|
||||||
dct['downloader_options'] = {
|
CHUNK_SIZE = 10 << 20
|
||||||
# Youtube throttles chunks >~10M
|
dct.update({
|
||||||
'http_chunk_size': 10485760,
|
'request_data': b'x',
|
||||||
}
|
'protocol': 'http_dash_segments',
|
||||||
|
'fragments': [{
|
||||||
|
'url': update_url_query(dct['url'], {
|
||||||
|
'range': f'{range_start}-{min(range_start + CHUNK_SIZE - 1, dct["filesize"])}'
|
||||||
|
})
|
||||||
|
} for range_start in range(0, dct['filesize'], CHUNK_SIZE)]
|
||||||
|
} if dct['filesize'] else {
|
||||||
|
'downloader_options': {'http_chunk_size': CHUNK_SIZE} # No longer useful?
|
||||||
|
})
|
||||||
|
|
||||||
if dct.get('ext'):
|
if dct.get('ext'):
|
||||||
dct['container'] = dct['ext'] + '_dash'
|
dct['container'] = dct['ext'] + '_dash'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user