1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import ExtractorError
10 class BYUtvIE(InfoExtractor):
11 _VALID_URL = r'^https?://(?:www\.)?byutv.org/watch/[0-9a-f-]+/(?P<video_id>[^/?#]+)'
13 'url': 'http://www.byutv.org/watch/6587b9a3-89d2-42a6-a7f7-fd2f81840a7d/studio-c-season-5-episode-5',
15 'id': 'studio-c-season-5-episode-5',
17 'description': 'md5:5438d33774b6bdc662f9485a340401cc',
18 'title': 'Season 5 Episode 5',
19 'thumbnail': 're:^https?://.*promo.*'
22 'skip_download': True,
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('video_id')
30 webpage = self._download_webpage(url, video_id)
31 episode_code = self._search_regex(
32 r'(?s)episode:(.*?\}),\s*\n', webpage, 'episode information')
33 episode_json = re.sub(
34 r'(\n\s+)([a-zA-Z]+):\s+\'(.*?)\'', r'\1"\2": "\3"', episode_code)
35 ep = json.loads(episode_json)
37 if ep['providerType'] == 'Ooyala':
39 '_type': 'url_transparent',
41 'url': 'ooyala:%s' % ep['providerId'],
44 'description': ep.get('description'),
45 'thumbnail': ep.get('imageThumbnail'),
48 raise ExtractorError('Unsupported provider %s' % ep['provider'])