2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_str
8 class RENTVIE(InfoExtractor):
9 _VALID_URL = r'(?:rentv:|https?://(?:www\.)?ren\.tv/(?:player|video/epizod)/)(?P<id>\d+)'
11 'url': 'http://ren.tv/video/epizod/118577',
12 'md5': 'd91851bf9af73c0ad9b2cdf76c127fbb',
16 'title': 'Документальный спецпроект: "Промывка мозгов. Технологии XXI века"'
19 'url': 'http://ren.tv/player/118577',
20 'only_matching': True,
22 'url': 'rentv:118577',
23 'only_matching': True,
26 def _real_extract(self, url):
27 video_id = self._match_id(url)
28 webpage = self._download_webpage('http://ren.tv/player/' + video_id, video_id)
29 config = self._parse_json(self._search_regex(
30 r'config\s*=\s*({.+});', webpage, 'config'), video_id)
32 for video in config.get('src', ''):
34 'url': video.get('src', '')
36 self._sort_formats(formats)
40 'title': config.get('title', ''),
41 'thumbnail': config.get('image', '')
45 class RENTVArticleIE(InfoExtractor):
46 _VALID_URL = r'https?://(?:www\.)?ren\.tv/novosti/\d{4}-\d{2}-\d{2}/(?P<id>[^/?#]+)'
48 'url': 'http://ren.tv/novosti/2016-10-26/video-mikroavtobus-popavshiy-v-dtp-s-gruzovikami-v-podmoskove-prevratilsya-v',
49 'md5': 'ebd63c4680b167693745ab91343df1d6',
53 'title': 'Видео: микроавтобус, попавший в ДТП с грузовиками в Подмосковье, превратился в груду металла',
54 'description': 'Жертвами столкновения двух фур и микроавтобуса, по последним данным, стали семь человек.',
58 'url': 'http://ren.tv/novosti/2015-09-25/sluchaynyy-prohozhiy-poymal-avtougonshchika-v-murmanske-video',
62 'title': 'Случайный прохожий поймал автоугонщика в Мурманске. ВИДЕО | РЕН ТВ',
67 'skip_download': True,
72 def _real_extract(self, url):
73 display_id = self._match_id(url)
74 webpage = self._download_webpage(url, display_id)
75 drupal_settings = self._parse_json(self._search_regex(
76 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
77 webpage, 'drupal settings'), display_id)
80 for config_profile in drupal_settings.get('ren_jwplayer', {}).values():
81 media_id = config_profile.get('mediaid')
84 media_id = compat_str(media_id)
85 entries.append(self.url_result('rentv:' + media_id, 'RENTV', media_id))
86 return self.playlist_result(entries, display_id)