2014-01-29 16:37:10 +01:00
|
|
|
|
# encoding: utf-8
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
2013-06-23 22:09:32 +02:00
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
from ..utils import (
|
2016-08-06 15:26:48 +02:00
|
|
|
|
clean_html
|
2013-06-23 22:09:32 +02:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RBMARadioIE(InfoExtractor):
|
2016-08-06 15:26:48 +02:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/[^/]+/episodes/(?P<id>[^/]+)$'
|
2013-06-27 20:46:46 +02:00
|
|
|
|
_TEST = {
|
2016-08-06 15:26:48 +02:00
|
|
|
|
'url': 'https://www.rbmaradio.com/shows/main-stage/episodes/ford-lopatin-live-at-primavera-sound-2011',
|
2014-01-29 16:37:10 +01:00
|
|
|
|
'md5': '6bc6f9bcb18994b4c983bc3bf4384d95',
|
|
|
|
|
'info_dict': {
|
2014-02-02 12:03:36 +01:00
|
|
|
|
'id': 'ford-lopatin-live-at-primavera-sound-2011',
|
|
|
|
|
'ext': 'mp3',
|
2016-02-14 10:37:17 +01: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 15:26:48 +02:00
|
|
|
|
'title': 'Ford & Lopatin - Main Stage',
|
2014-01-29 16:37:10 +01:00
|
|
|
|
},
|
2013-06-27 20:46:46 +02:00
|
|
|
|
}
|
2013-06-23 22:09:32 +02:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2016-08-06 15:26:48 +02:00
|
|
|
|
video_id = self._match_id(url)
|
2013-06-23 22:09:32 +02:00
|
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2016-08-06 15:26:48 +02: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 22:09:32 +02:00
|
|
|
|
|
2016-08-06 15:26:48 +02:00
|
|
|
|
item = None
|
|
|
|
|
for episode in data['episodes']:
|
|
|
|
|
items = data['episodes'][episode]
|
|
|
|
|
if video_id in items:
|
|
|
|
|
item = items[video_id]
|
2013-06-23 22:09:32 +02:00
|
|
|
|
|
2016-08-06 15:26:48 +02:00
|
|
|
|
video_url = item['audioURL'] + '?cbr=256'
|
2014-01-29 16:37:10 +01:00
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
|
|
|
|
'url': video_url,
|
2016-08-06 15:26:48 +02: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 22:09:32 +02:00
|
|
|
|
}
|