]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/ntvru.py
1 from .common
import InfoExtractor
10 class NTVRuIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?ntv\.ru/(?:[^/]+/)*(?P<id>[^/?#&]+)'
15 'url': 'http://www.ntv.ru/novosti/863142/',
16 'md5': 'ba7ea172a91cb83eb734cad18c10e723',
20 'title': 'Командующий Черноморским флотом провел переговоры в штабе ВМС Украины',
21 'description': 'Командующий Черноморским флотом провел переговоры в штабе ВМС Украины',
22 'thumbnail': r
're:^http://.*\.jpg',
26 'url': 'http://www.ntv.ru/video/novosti/750370/',
27 'md5': 'adecff79691b4d71e25220a191477124',
31 'title': 'Родные пассажиров пропавшего Boeing не верят в трагический исход',
32 'description': 'Родные пассажиров пропавшего Boeing не верят в трагический исход',
33 'thumbnail': r
're:^http://.*\.jpg',
37 'url': 'http://www.ntv.ru/peredacha/segodnya/m23700/o232416',
38 'md5': '82dbd49b38e3af1d00df16acbeab260c',
42 'title': '«Сегодня». 21 марта 2014 года. 16:00',
43 'description': '«Сегодня». 21 марта 2014 года. 16:00',
44 'thumbnail': r
're:^http://.*\.jpg',
48 'url': 'https://www.ntv.ru/kino/Koma_film/m70281/o336036/video/',
49 'md5': 'e9c7cde24d9d3eaed545911a04e6d4f4',
53 'title': 'Остросюжетный фильм «Кома»',
54 'description': 'Остросюжетный фильм «Кома»',
55 'thumbnail': r
're:^http://.*\.jpg',
59 'url': 'http://www.ntv.ru/serial/Delo_vrachey/m31760/o233916/',
60 'md5': '9320cd0e23f3ea59c330dc744e06ff3b',
64 'title': '«Дело врачей»: «Деревце жизни»',
65 'description': '«Дело врачей»: «Деревце жизни»',
66 'thumbnail': r
're:^http://.*\.jpg',
71 'url': 'https://www.ntv.ru/video/1797442',
72 'only_matching': True,
76 r
'<meta property="og:url" content="http://www\.ntv\.ru/video/(\d+)',
77 r
'<video embed=[^>]+><id>(\d+)</id>',
78 r
'<video restriction[^>]+><key>(\d+)</key>',
81 def _real_extract(self
, url
):
82 video_id
= self
._match
_id
(url
)
84 webpage
= self
._download
_webpage
(url
, video_id
)
86 video_url
= self
._og
_search
_property
(
87 ('video', 'video:iframe'), webpage
, default
=None)
89 video_id
= self
._search
_regex
(
90 r
'https?://(?:www\.)?ntv\.ru/video/(?:embed/)?(\d+)',
91 video_url
, 'video id', default
=None)
94 video_id
= self
._html
_search
_regex
(
95 self
._VIDEO
_ID
_REGEXES
, webpage
, 'video id')
97 player
= self
._download
_xml
(
98 'http://www.ntv.ru/vi%s/' % video_id
,
99 video_id
, 'Downloading video XML')
101 title
= strip_or_none(unescapeHTML(xpath_text(player
, './data/title', 'title', fatal
=True)))
103 video
= player
.find('./data/video')
106 for format_id
in ['', 'hi', 'webm']:
107 file_
= xpath_text(video
, './%sfile' % format_id
)
110 if file_
.startswith('//'):
111 file_
= self
._proto
_relative
_url
(file_
)
112 elif not file_
.startswith('http'):
113 file_
= 'http://media.ntv.ru/vod/' + file_
116 'filesize': int_or_none(xpath_text(video
, './%ssize' % format_id
)),
118 self
._sort
_formats
(formats
)
121 'id': xpath_text(video
, './id'),
123 'description': strip_or_none(unescapeHTML(xpath_text(player
, './data/description'))),
124 'thumbnail': xpath_text(video
, './splash'),
125 'duration': int_or_none(xpath_text(video
, './totaltime')),
126 'view_count': int_or_none(xpath_text(video
, './views')),