Create last_segment_url only if necessary

This commit is contained in:
Elyse 2023-03-09 18:24:31 -06:00
parent fba1c397b1
commit e42e25619f

View File

@ -2853,12 +2853,13 @@ def _extract_sequence_from_mpd(refresh_sequence, immediate):
known_idx = idx - 1
raise ExtractorError('breaking out of outer loop')
last_segment_url = urljoin(fragment_base_url, 'sq/%d' % idx)
frag_duration = last_fragment['duration']
frag_start = last_fragment['start'] - (last_seq - idx) * frag_duration
frag_end = frag_start + frag_duration
if frag_start >= section_start and frag_end <= section_end:
last_segment_url = urljoin(fragment_base_url, f'sq/{idx}')
yield {
'url': last_segment_url,
'duration': frag_duration,