4 from .common
import InfoExtractor
6 compat_urllib_parse_urlparse
,
12 class RBMARadioIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$'
15 def _real_extract(self
, url
):
16 m
= re
.match(self
._VALID
_URL
, url
)
17 video_id
= m
.group('videoID')
19 webpage
= self
._download
_webpage
(url
, video_id
)
21 json_data
= self
._search
_regex
(r
'window\.gon.*?gon\.show=(.+?);$',
22 webpage
, u
'json data', flags
=re
.MULTILINE
)
25 data
= json
.loads(json_data
)
26 except ValueError as e
:
27 raise ExtractorError(u
'Invalid JSON: ' + str(e
))
29 video_url
= data
['akamai_url'] + '&cbr=256'
30 url_parts
= compat_urllib_parse_urlparse(video_url
)
31 video_ext
= url_parts
.path
.rpartition('.')[2]
36 'title': data
['title'],
37 'description': data
.get('teaser_text'),
38 'location': data
.get('country_of_origin'),
39 'uploader': data
.get('host', {}).get('name'),
40 'uploader_id': data
.get('host', {}).get('slug'),
41 'thumbnail': data
.get('image', {}).get('large_url_2x'),
42 'duration': data
.get('duration'),