1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 19:52:11 +00:00

[extractor/common] Add durations for DASH fragments with bare SegmentURLs

This commit is contained in:
Sergey M․ 2017-12-02 21:10:35 +07:00
parent 41bf647e89
commit 603fc4e0ea
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -1979,10 +1979,16 @@ class InfoExtractor(object):
# Segment URLs with no SegmentTimeline # Segment URLs with no SegmentTimeline
# Example: https://www.seznam.cz/zpravy/clanek/cesko-zasahne-vitr-o-sile-vichrice-muze-byt-i-zivotu-nebezpecny-39091 # Example: https://www.seznam.cz/zpravy/clanek/cesko-zasahne-vitr-o-sile-vichrice-muze-byt-i-zivotu-nebezpecny-39091
fragments = [] fragments = []
segment_duration = float_or_none(
representation_ms_info['segment_duration'],
representation_ms_info['timescale']) if 'segment_duration' in representation_ms_info else None
for segment_url in representation_ms_info['segment_urls']: for segment_url in representation_ms_info['segment_urls']:
fragments.append({ fragment = {
location_key(segment_url): segment_url, location_key(segment_url): segment_url,
}) }
if segment_duration:
fragment['duration'] = segment_duration
fragments.append(fragment)
representation_ms_info['fragments'] = fragments representation_ms_info['fragments'] = fragments
# NB: MPD manifest may contain direct URLs to unfragmented media. # NB: MPD manifest may contain direct URLs to unfragmented media.
# No fragments key is present in this case. # No fragments key is present in this case.