- for fmt in ['windows', 'android_tablet']:
- request = compat_urllib_request.Request(
- self._URL_VIDEO_TEMPLATE.format(fmt, episode_id, timestamp_shifted, token))
- request.add_header('Youtubedl-user-agent', self._USER_AGENT)
-
- fmt_json = self._download_json(
- request, video_id, 'Downloading %s video JSON' % fmt)
-
- result = fmt_json.get('resultDes')
- if result.lower() != 'ok':
- raise ExtractorError(
- '%s returned error: %s' % (self.IE_NAME, result), expected=True)
-
- for _, video_url in fmt_json['resultObject'].items():
- if video_url.endswith('/Manifest'):
- formats.extend(self._extract_f4m_formats(video_url[:-9] + '/manifest.f4m', video_id))
- else:
- formats.append({
- 'url': video_url,
- 'format_id': 'android',
- 'preference': 1,
- })
+ for source in episode.get('sources', []):
+ src = source.get('src')
+ if not src:
+ continue
+ src_type = source.get('type')
+ if src_type == 'application/vnd.apple.mpegurl':
+ formats.extend(self._extract_m3u8_formats(
+ src, video_id, 'mp4', 'm3u8_native',
+ m3u8_id='hls', fatal=False))
+ elif src_type == 'application/dash+xml':
+ formats.extend(self._extract_mpd_formats(
+ src, video_id, mpd_id='dash', fatal=False))