about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-12-02 21:10:35 +0700
committerSergey M․ <dstftw@gmail.com>2017-12-02 21:21:01 +0700
commit603fc4e0ea472c7c2a78ff201d69686a9e3fe1f2 (patch)
treea03bd98fe7d1f7ac8960a5868b106e9ae856b828
parent41bf647e895faca42cdc2565ea034ed341593f8e (diff)
downloadyoutube-dl-603fc4e0ea472c7c2a78ff201d69686a9e3fe1f2.tar.gz
youtube-dl-603fc4e0ea472c7c2a78ff201d69686a9e3fe1f2.tar.xz
youtube-dl-603fc4e0ea472c7c2a78ff201d69686a9e3fe1f2.zip
[extractor/common] Add durations for DASH fragments with bare SegmentURLs
-rw-r--r--youtube_dl/extractor/common.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 15999411b..3baf683d8 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -1979,10 +1979,16 @@ class InfoExtractor(object):
                             # Segment URLs with no SegmentTimeline
                             # Example: https://www.seznam.cz/zpravy/clanek/cesko-zasahne-vitr-o-sile-vichrice-muze-byt-i-zivotu-nebezpecny-39091
                             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']:
-                                fragments.append({
+                                fragment = {
                                     location_key(segment_url): segment_url,
-                                })
+                                }
+                                if segment_duration:
+                                    fragment['duration'] = segment_duration
+                                fragments.append(fragment)
                             representation_ms_info['fragments'] = fragments
                         # NB: MPD manifest may contain direct URLs to unfragmented media.
                         # No fragments key is present in this case.