1 from .common
import InfoExtractor
8 class CJSWIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?cjsw\.com/program/(?P<program>[^/]+)/episode/(?P<id>\d+)'
11 'url': 'http://cjsw.com/program/freshly-squeezed/episode/20170620',
12 'md5': 'cee14d40f1e9433632c56e3d14977120',
14 'id': '91d9f016-a2e7-46c5-8dcb-7cbcd7437c41',
16 'title': 'Freshly Squeezed – Episode June 20, 2017',
17 'description': 'md5:c967d63366c3898a80d0c7b0ff337202',
18 'series': 'Freshly Squeezed',
19 'episode_id': '20170620',
23 'url': 'http://cjsw.com/program/road-pops/episode/20170707/',
24 'only_matching': True,
27 def _real_extract(self
, url
):
28 mobj
= self
._match
_valid
_url
(url
)
29 program
, episode_id
= mobj
.group('program', 'id')
30 audio_id
= f
'{program}/{episode_id}'
32 webpage
= self
._download
_webpage
(url
, episode_id
)
34 title
= unescapeHTML(self
._search
_regex
(
35 (r
'<h1[^>]+class=["\']episode
-header__title
["\'][^>]*>(?P<title>[^<]+)',
36 r'data-audio-title=(["\'])(?P
<title
>(?
:(?
!\
1).)+)\
1'),
37 webpage, 'title
', group='title
'))
39 audio_url = self._search_regex(
40 r'<button
[^
>]+data
-audio
-src
=(["\'])(?P<url>(?:(?!\1).)+)\1',
41 webpage, 'audio url', group='url')
43 audio_id = self._search_regex(
44 r'/([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})\.mp3',
45 audio_url, 'audio id', default=audio_id)
49 'ext': determine_ext(audio_url, 'mp3'),
53 description = self._html_search_regex(
54 r'<p>(?P<description>.+?)</p>', webpage, 'description',
56 series = self._search_regex(
57 r'data-showname=(["\'])(?P
<name
>(?
:(?
!\
1).)+)\
1', webpage,
58 'series
', default=program, group='name
')
63 'description
': description,
66 'episode_id
': episode_id,