2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class CJSWIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?cjsw\.com/program/(?P<program>[^/]+)/episode/(?P<id>\d+)'
16 'url': 'http://cjsw.com/program/freshly-squeezed/episode/20170620',
17 'md5': 'cee14d40f1e9433632c56e3d14977120',
19 'id': '91d9f016-a2e7-46c5-8dcb-7cbcd7437c41',
21 'title': 'Freshly Squeezed – Episode June 20, 2017',
22 'description': 'md5:c967d63366c3898a80d0c7b0ff337202',
23 'series': 'Freshly Squeezed',
24 'episode_id': '20170620',
28 'url': 'http://cjsw.com/program/road-pops/episode/20170707/',
29 'only_matching': True,
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
34 program, episode_id = mobj.group('program', 'id')
35 audio_id = '%s/%s' % (program, episode_id)
37 webpage = self._download_webpage(url, episode_id)
39 title = unescapeHTML(self._search_regex(
40 (r'<h1[^>]+class=["\']episode-header__title["\'][^>]*>(?P<title>[^<]+)',
41 r'data-audio-title=(["\'])(?P<title>(?:(?!\1).)+)\1'),
42 webpage, 'title', group='title'))
44 audio_url = self._search_regex(
45 r'<button[^>]+data-audio-src=(["\'])(?P<url>(?:(?!\1).)+)\1',
46 webpage, 'audio url', group='url')
48 audio_id = self._search_regex(
49 r'/([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})\.mp3',
50 audio_url, 'audio id', default=audio_id)
54 'ext': determine_ext(audio_url, 'mp3'),
58 description = self._html_search_regex(
59 r'<p>(?P<description>.+?)</p>', webpage, 'description',
61 series = self._search_regex(
62 r'data-showname=(["\'])(?P<name>(?:(?!\1).)+)\1', webpage,
63 'series', default=program, group='name')
68 'description': description,
71 'episode_id': episode_id,