[extractor/common] Make HLS and DASH extraction non fatal in _parse_html5_media_entri...
[youtube-dl] / youtube_dl / extractor / common.py
index e565901afce0ec6999a478ddf21b0b6745a6a966..ceba4ca1c415cec0381d9d152dc72a7d6bf255fe 100644 (file)
@@ -1786,7 +1786,7 @@ class InfoExtractor(object):
                     ms_info['timescale'] = int(timescale)
                 segment_duration = source.get('duration')
                 if segment_duration:
-                    ms_info['segment_duration'] = int(segment_duration)
+                    ms_info['segment_duration'] = float(segment_duration)
 
             def extract_Initialization(source):
                 initialization = source.find(_add_ns('Initialization'))
@@ -2115,7 +2115,7 @@ class InfoExtractor(object):
                 return f
             return {}
 
-        def _media_formats(src, type_info, cur_media_type):
+        def _media_formats(src, cur_media_type, type_info={}):
             full_url = absolute_url(src)
             ext = type_info.get('ext') or determine_ext(full_url)
             if ext == 'm3u8':
@@ -2123,11 +2123,11 @@ class InfoExtractor(object):
                 formats = self._extract_m3u8_formats(
                     full_url, video_id, ext='mp4',
                     entry_protocol=m3u8_entry_protocol, m3u8_id=m3u8_id,
-                    preference=preference)
+                    preference=preference, fatal=False)
             elif ext == 'mpd':
                 is_plain_url = False
                 formats = self._extract_mpd_formats(
-                    full_url, video_id, mpd_id=mpd_id)
+                    full_url, video_id, mpd_id=mpd_id, fatal=False)
             else:
                 is_plain_url = True
                 formats = [{
@@ -2167,7 +2167,7 @@ class InfoExtractor(object):
                     if not src:
                         continue
                     f = parse_content_type(source_attributes.get('type'))
-                    is_plain_url, formats = _media_formats(src, f, media_type)
+                    is_plain_url, formats = _media_formats(src, media_type, f)
                     if is_plain_url:
                         f.update(formats[0])
                         media_info['formats'].append(f)