- json_s = self._html_search_regex(
- r'data-video-sources="(.+?)"', webpage, 'json')
- src = try_get(
- self._parse_json(json_s, video_id),
- lambda x: x[0]["src"], compat_str)
- formats = []
- subtitles = {}
- if re.search(r'\.m3u8\??', src):
- res = self._download_webpage_handle(
- # elonet servers have certificate problems
- src.replace('https:', 'http:'), video_id,
- note='Downloading m3u8 information',
- errnote='Failed to download m3u8 information')
- if res:
- doc, urlh = res
- url = urlh.geturl()
- formats, subtitles = self._parse_m3u8_formats_and_subtitles(doc, url)
- for f in formats:
- f['ext'] = 'mp4'
- elif re.search(r'\.mpd\??', src):
- res = self._download_xml_handle(
- src, video_id,
- note='Downloading MPD manifest',
- errnote='Failed to download MPD manifest')
- if res:
- doc, urlh = res
- url = base_url(urlh.geturl())
- formats, subtitles = self._parse_mpd_formats_and_subtitles(doc, mpd_base_url=url)
+ if ext == 'm3u8':
+ formats, subtitles = self._extract_m3u8_formats_and_subtitles(src, video_id, fatal=False)
+ elif ext == 'mpd':
+ formats, subtitles = self._extract_mpd_formats_and_subtitles(src, video_id, fatal=False)