2014-01-29 08:37:10 -07:00
|
|
|
|
# encoding: utf-8
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
2013-06-23 14:09:32 -06:00
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
from ..utils import (
|
2016-08-06 07:26:48 -06:00
|
|
|
|
clean_html
|
2013-06-23 14:09:32 -06:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RBMARadioIE(InfoExtractor):
|
2016-08-06 07:26:48 -06:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/[^/]+/episodes/(?P<id>[^/]+)$'
|
2013-06-27 12:46:46 -06:00
|
|
|
|
_TEST = {
|
2016-08-06 07:26:48 -06:00
|
|
|
|
'url': 'https://www.rbmaradio.com/shows/main-stage/episodes/ford-lopatin-live-at-primavera-sound-2011',
|
2014-01-29 08:37:10 -07:00
|
|
|
|
'md5': '6bc6f9bcb18994b4c983bc3bf4384d95',
|
|
|
|
|
'info_dict': {
|
2014-02-02 04:03:36 -07:00
|
|
|
|
'id': 'ford-lopatin-live-at-primavera-sound-2011',
|
|
|
|
|
'ext': 'mp3',
|
2016-02-14 02:37:17 -07:00
|
|
|
|
'description': 'Joel Ford and Daniel ’Oneohtrix Point Never’ Lopatin fly their midified pop extravaganza to Spain. Live at Primavera Sound 2011.',
|
2016-08-06 07:26:48 -06:00
|
|
|
|
'title': 'Ford & Lopatin - Main Stage',
|
2014-01-29 08:37:10 -07:00
|
|
|
|
},
|
2013-06-27 12:46:46 -06:00
|
|
|
|
}
|
2013-06-23 14:09:32 -06:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2016-08-06 07:26:48 -06:00
|
|
|
|
video_id = self._match_id(url)
|
2013-06-23 14:09:32 -06:00
|
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2016-08-06 07:26:48 -06:00
|
|
|
|
json_data = self._search_regex(r'<script>window\.__INITIAL_STATE__\s*=\s*(.+?)</script>',
|
|
|
|
|
webpage, 'json data')
|
|
|
|
|
data = self._parse_json(json_data, video_id)
|
2013-06-23 14:09:32 -06:00
|
|
|
|
|
2016-08-06 07:26:48 -06:00
|
|
|
|
item = None
|
|
|
|
|
for episode in data['episodes']:
|
|
|
|
|
items = data['episodes'][episode]
|
|
|
|
|
if video_id in items:
|
|
|
|
|
item = items[video_id]
|
2013-06-23 14:09:32 -06:00
|
|
|
|
|
2016-08-06 07:26:48 -06:00
|
|
|
|
video_url = item['audioURL'] + '?cbr=256'
|
2014-01-29 08:37:10 -07:00
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
|
|
|
|
'url': video_url,
|
2016-08-06 07:26:48 -06:00
|
|
|
|
'title': item.get('title') + ' - ' + item.get('showTitle'),
|
|
|
|
|
'description': clean_html(item.get('longTeaser')),
|
|
|
|
|
'thumbnail': self._proto_relative_url(item.get('imageURL', {}).get('landscape')),
|
|
|
|
|
'duration': item.get('duration'),
|
2013-06-23 14:09:32 -06:00
|
|
|
|
}
|