mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[extractor/youtube] Construct fragment list lazily
Building fragment list for all formats take significant time for large videos
This commit is contained in:
parent
86cb922118
commit
2a23d92d9e
@ -3777,11 +3777,11 @@ def _extract_formats_and_subtitles(self, streaming_data, video_id, player_url, l
|
|||||||
**dct,
|
**dct,
|
||||||
'format_id': f'{dct["format_id"]}-dashy' if all_formats else dct['format_id'],
|
'format_id': f'{dct["format_id"]}-dashy' if all_formats else dct['format_id'],
|
||||||
'protocol': 'http_dash_segments',
|
'protocol': 'http_dash_segments',
|
||||||
'fragments': [{
|
'fragments': LazyList({
|
||||||
'url': update_url_query(dct['url'], {
|
'url': update_url_query(dct['url'], {
|
||||||
'range': f'{range_start}-{min(range_start + CHUNK_SIZE - 1, dct["filesize"])}'
|
'range': f'{range_start}-{min(range_start + CHUNK_SIZE - 1, dct["filesize"])}'
|
||||||
})
|
})
|
||||||
} for range_start in range(0, dct['filesize'], CHUNK_SIZE)]
|
} for range_start in range(0, dct['filesize'], CHUNK_SIZE))
|
||||||
}
|
}
|
||||||
if not all_formats:
|
if not all_formats:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user