1 from .common
import InfoExtractor
2 from ..compat
import compat_str
10 class RENTVIE(InfoExtractor
):
12 _VALID_URL
= r
'(?:rentv:|https?://(?:www\.)?ren\.tv/(?:player|video/epizod)/)(?P<id>\d+)'
14 'url': 'http://ren.tv/video/epizod/118577',
15 'md5': 'd91851bf9af73c0ad9b2cdf76c127fbb',
19 'title': 'Документальный спецпроект: "Промывка мозгов. Технологии XXI века"',
20 'timestamp': 1472230800,
21 'upload_date': '20160826',
24 'url': 'http://ren.tv/player/118577',
25 'only_matching': True,
27 'url': 'rentv:118577',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
('http://ren.tv/player/' + video_id
, video_id
)
34 config
= self
._parse
_json
(self
._search
_regex
(
35 r
'config\s*=\s*({.+})\s*;', webpage
, 'config'), video_id
)
36 title
= config
['title']
38 for video
in config
['src']:
39 src
= url_or_none(video
.get('src'))
42 ext
= determine_ext(src
)
44 formats
.extend(self
._extract
_m
3u8_formats
(
45 src
, video_id
, 'mp4', entry_protocol
='m3u8_native',
46 m3u8_id
='hls', fatal
=False))
54 'description': config
.get('description'),
55 'thumbnail': config
.get('image'),
56 'duration': int_or_none(config
.get('duration')),
57 'timestamp': int_or_none(config
.get('date')),
62 class RENTVArticleIE(InfoExtractor
):
64 _VALID_URL
= r
'https?://(?:www\.)?ren\.tv/novosti/\d{4}-\d{2}-\d{2}/(?P<id>[^/?#]+)'
66 'url': 'http://ren.tv/novosti/2016-10-26/video-mikroavtobus-popavshiy-v-dtp-s-gruzovikami-v-podmoskove-prevratilsya-v',
67 'md5': 'ebd63c4680b167693745ab91343df1d6',
71 'title': 'Видео: микроавтобус, попавший в ДТП с грузовиками в Подмосковье, превратился в груду металла',
72 'description': 'Жертвами столкновения двух фур и микроавтобуса, по последним данным, стали семь человек.',
76 'url': 'http://ren.tv/novosti/2015-09-25/sluchaynyy-prohozhiy-poymal-avtougonshchika-v-murmanske-video',
80 'title': 'Случайный прохожий поймал автоугонщика в Мурманске. ВИДЕО | РЕН ТВ',
85 'skip_download': True,
90 def _real_extract(self
, url
):
91 display_id
= self
._match
_id
(url
)
92 webpage
= self
._download
_webpage
(url
, display_id
)
93 drupal_settings
= self
._parse
_json
(self
._search
_regex
(
94 r
'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
95 webpage
, 'drupal settings'), display_id
)
98 for config_profile
in drupal_settings
.get('ren_jwplayer', {}).values():
99 media_id
= config_profile
.get('mediaid')
102 media_id
= compat_str(media_id
)
103 entries
.append(self
.url_result('rentv:' + media_id
, 'RENTV', media_id
))
104 return self
.playlist_result(entries
, display_id
)