]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/cjsw.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class CJSWIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?cjsw\.com/program/(?P<program>[^/]+)/episode/(?P<id>\d+)'
15 'url': 'http://cjsw.com/program/freshly-squeezed/episode/20170620',
16 'md5': 'cee14d40f1e9433632c56e3d14977120',
18 'id': '91d9f016-a2e7-46c5-8dcb-7cbcd7437c41',
20 'title': 'Freshly Squeezed – Episode June 20, 2017',
21 'description': 'md5:c967d63366c3898a80d0c7b0ff337202',
22 'series': 'Freshly Squeezed',
23 'episode_id': '20170620',
27 'url': 'http://cjsw.com/program/road-pops/episode/20170707/',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 mobj
= self
._match
_valid
_url
(url
)
33 program
, episode_id
= mobj
.group('program', 'id')
34 audio_id
= '%s/%s' % (program
, episode_id
)
36 webpage
= self
._download
_webpage
(url
, episode_id
)
38 title
= unescapeHTML(self
._search
_regex
(
39 (r
'<h1[^>]+class=["\']episode
-header__title
["\'][^>]*>(?P<title>[^<]+)',
40 r'data-audio-title=(["\'])(?P
<title
>(?
:(?
!\
1).)+)\
1'),
41 webpage, 'title
', group='title
'))
43 audio_url = self._search_regex(
44 r'<button
[^
>]+data
-audio
-src
=(["\'])(?P<url>(?:(?!\1).)+)\1',
45 webpage, 'audio url', group='url')
47 audio_id = self._search_regex(
48 r'/([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})\.mp3',
49 audio_url, 'audio id', default=audio_id)
53 'ext': determine_ext(audio_url, 'mp3'),
57 description = self._html_search_regex(
58 r'<p>(?P<description>.+?)</p>', webpage, 'description',
60 series = self._search_regex(
61 r'data-showname=(["\'])(?P
<name
>(?
:(?
!\
1).)+)\
1', webpage,
62 'series
', default=program, group='name
')
67 'description
': description,
70 'episode_id
': episode_id,