2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from .jwplatform import JWPlatformBaseIE
6 from ..compat import compat_str
9 class RENTVIE(JWPlatformBaseIE):
10 _VALID_URL = r'(?:rentv:|https?://(?:www\.)?ren\.tv/(?:player|video/epizod)/)(?P<id>\d+)'
12 'url': 'http://ren.tv/video/epizod/118577',
13 'md5': 'd91851bf9af73c0ad9b2cdf76c127fbb',
17 'title': 'Документальный спецпроект: "Промывка мозгов. Технологии XXI века"'
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage = self._download_webpage('http://ren.tv/player/' + video_id, video_id)
24 jw_config = self._parse_json(self._search_regex(
25 r'config\s*=\s*({.+});', webpage, 'jw config'), video_id)
26 return self._parse_jwplayer_data(jw_config, video_id, m3u8_id='hls')
29 class RENTVArticleIE(InfoExtractor):
30 _VALID_URL = r'https?://(?:www\.)?ren\.tv/novosti/\d{4}-\d{2}-\d{2}/(?P<id>[^/?#]+)'
32 'url': 'http://ren.tv/novosti/2016-10-26/video-mikroavtobus-popavshiy-v-dtp-s-gruzovikami-v-podmoskove-prevratilsya-v',
33 'md5': 'ebd63c4680b167693745ab91343df1d6',
37 'title': 'Видео: микроавтобус, попавший в ДТП с грузовиками в Подмосковье, превратился в груду металла',
38 'description': 'Жертвами столкновения двух фур и микроавтобуса, по последним данным, стали семь человек.',
42 def _real_extract(self, url):
43 display_id = self._match_id(url)
44 webpage = self._download_webpage(url, display_id)
45 drupal_settings = self._parse_json(self._search_regex(
46 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
47 webpage, 'drupal settings'), display_id)
50 for config_profile in drupal_settings.get('ren_jwplayer', {}).values():
51 media_id = config_profile.get('mediaid')
54 media_id = compat_str(media_id)
55 entries.append(self.url_result('rentv:' + media_id, 'RENTV', media_id))
56 return self.playlist_result(entries, display_id)