-
- webpage = self._download_webpage(url, display_id)
-
- episode = strip_or_none(unescapeHTML(self._search_regex(
- (r'videoTitle\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1',
- r'<title>(?P<title>[^<]+)</title>'), webpage, 'title',
- default=None, group='title')))
-
- title = strip_or_none(self._og_search_title(
- webpage, default=None)) or episode
-
- m3u8_url = self._search_regex(
- r'file\s*:\s*(["\'])(?P<url>http.+?\.m3u8.*?)\1',
- webpage, 'm3u8 url', default=None, group='url')
-
- if not m3u8_url:
- if re.search(r'<div[^>]+class=["\']non-sponsor', webpage):
- self.raise_login_required(
- '%s is only available for FIRST members' % display_id)
-
- if re.search(r'<div[^>]+class=["\']golive-gate', webpage):
- self.raise_login_required('%s is not available yet' % display_id)
-
- raise ExtractorError('Unable to extract m3u8 URL')
+ api_episode_url = self._EPISODE_BASE_URL + display_id
+
+ try:
+ m3u8_url = self._download_json(
+ api_episode_url + '/videos', display_id,
+ 'Downloading video JSON metadata')['data'][0]['attributes']['url']
+ except ExtractorError as e:
+ if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
+ if self._parse_json(e.cause.read().decode(), display_id).get('access') is False:
+ self.raise_login_required(
+ '%s is only available for FIRST members' % display_id)
+ raise