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 u
'url': u
'http://www.rbmaradio.com/shows/ford-lopatin-live-at-primavera-sound-2011',
16 u
'file': u
'ford-lopatin-live-at-primavera-sound-2011.mp3',
17 u
'md5': u
'6bc6f9bcb18994b4c983bc3bf4384d95',
19 u
"uploader_id": u
"ford-lopatin",
20 u
"location": u
"Spain",
21 u
"description": u
"Joel Ford and Daniel \u2019Oneohtrix Point Never\u2019 Lopatin fly their midified pop extravaganza to Spain. Live at Primavera Sound 2011.",
22 u
"uploader": u
"Ford & Lopatin",
23 u
"title": u
"Live at Primavera Sound 2011"
27 def _real_extract(self
, url
):
28 m
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= m
.group('videoID')
31 webpage
= self
._download
_webpage
(url
, video_id
)
33 json_data
= self
._search
_regex
(r
'window\.gon.*?gon\.show=(.+?);$',
34 webpage
, u
'json data', flags
=re
.MULTILINE
)
37 data
= json
.loads(json_data
)
38 except ValueError as e
:
39 raise ExtractorError(u
'Invalid JSON: ' + str(e
))
41 video_url
= data
['akamai_url'] + '&cbr=256'
42 url_parts
= compat_urllib_parse_urlparse(video_url
)
43 video_ext
= url_parts
.path
.rpartition('.')[2]
48 'title': data
['title'],
49 'description': data
.get('teaser_text'),
50 'location': data
.get('country_of_origin'),
51 'uploader': data
.get('host', {}).get('name'),
52 'uploader_id': data
.get('host', {}).get('slug'),
53 'thumbnail': data
.get('image', {}).get('large_url_2x'),
54 'duration': data
.get('duration'),