Delegate to RaiPlayIE

This commit is contained in:
james 2017-06-20 17:40:12 +02:00
parent 7d85663a85
commit 0a3a0abb4b

View File

@ -225,45 +225,13 @@ class RaiPlayLiveIE(RaiBaseIE):
webpage = self._download_webpage(url, channel)
re_id = r'<div([^>]*)data-uniquename=(["\'])[\w-]*(?P<id>%s)(\2)([^>]*?)>' % RaiBaseIE._UUID_RE
video_id = self._html_search_regex(re_id, webpage, 'livestream-id', group='id')
url = 'http://www.raiplay.it/dirette/ContentItem-%s.html' % video_id
media = self._download_json(
'%s?json' % url, video_id, 'Downloading video JSON')
title = media['name']
video = media['video']
relinker_info = self._extract_relinker_info(video['contentUrl'], video_id)
self._sort_formats(relinker_info['formats'])
thumbnails = []
if 'images' in media:
for _, value in media.get('images').items():
if value:
thumbnails.append({
'url': value.replace('[RESOLUTION]', '600x400')
})
timestamp = unified_timestamp(try_get(
media, lambda x: x['availabilities'][0]['start'], compat_str))
subtitles = self._extract_subtitles(url, video.get('subtitles'))
info = {
'id': video_id,
'title': title,
'alt_title': media.get('subtitle'),
'description': media.get('description'),
'uploader': media.get('channel'),
'creator': media.get('editor'),
'timestamp': timestamp,
'thumbnails': thumbnails,
'subtitles': subtitles,
return {
'_type': 'url_transparent',
'url': 'http://www.raiplay.it/dirette/ContentItem-%s.html' % video_id,
'ie_key': RaiPlayIE.ie_key()
}
info.update(relinker_info)
return info
class RaiIE(RaiBaseIE):
_VALID_URL = r'https?://[^/]+\.(?:rai\.(?:it|tv)|rainews\.it)/dl/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE