]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/ntv.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class NTVIE(InfoExtractor
):
14 _VALID_URL
= r
'http://(?:www\.)?ntv\.ru/(?P<id>.+)'
18 'url': 'http://www.ntv.ru/novosti/863142/',
22 'title': 'Командующий Черноморским флотом провел переговоры в штабе ВМС Украины',
23 'description': 'Командующий Черноморским флотом провел переговоры в штабе ВМС Украины',
28 'skip_download': True,
32 'url': 'http://www.ntv.ru/video/novosti/750370/',
36 'title': 'Родные пассажиров пропавшего Boeing не верят в трагический исход',
37 'description': 'Родные пассажиров пропавшего Boeing не верят в трагический исход',
42 'skip_download': True,
46 'url': 'http://www.ntv.ru/peredacha/segodnya/m23700/o232416',
50 'title': '«Сегодня». 21 марта 2014 года. 16:00 ',
51 'description': '«Сегодня». 21 марта 2014 года. 16:00 ',
56 'skip_download': True,
60 'url': 'http://www.ntv.ru/kino/Koma_film',
64 'title': 'Остросюжетный фильм «Кома»',
65 'description': 'Остросюжетный фильм «Кома»',
70 'skip_download': True,
74 'url': 'http://www.ntv.ru/serial/Delo_vrachey/m31760/o233916/',
78 'title': '«Дело врачей»: «Деревце жизни»',
79 'description': '«Дело врачей»: «Деревце жизни»',
84 'skip_download': True,
90 r
'<meta property="og:url" content="http://www\.ntv\.ru/video/(\d+)',
91 r
'<video embed=[^>]+><id>(\d+)</id>',
92 r
'<video restriction[^>]+><key>(\d+)</key>'
95 def _real_extract(self
, url
):
96 mobj
= re
.match(self
._VALID
_URL
, url
)
97 video_id
= mobj
.group('id')
99 page
= self
._download
_webpage
(url
, video_id
, 'Downloading page')
101 for pattern
in self
._VIDEO
_ID
_REGEXES
:
102 mobj
= re
.search(pattern
, page
)
107 raise ExtractorError('No media links available for %s' % video_id
)
109 video_id
= mobj
.group(1)
111 player
= self
._download
_xml
('http://www.ntv.ru/vi%s/' % video_id
, video_id
, 'Downloading video XML')
112 title
= unescapeHTML(player
.find('./data/title').text
)
113 description
= unescapeHTML(player
.find('./data/description').text
)
115 video
= player
.find('./data/video')
116 video_id
= video
.find('./id').text
117 thumbnail
= video
.find('./splash').text
118 duration
= int(video
.find('./totaltime').text
)
119 view_count
= int(video
.find('./views').text
)
120 puid22
= video
.find('./puid22').text
127 app
= apps
[puid22
] if puid22
in apps
else apps
['4']
130 for format_id
in ['', 'hi', 'webm']:
131 file = video
.find('./%sfile' % format_id
)
134 size
= video
.find('./%ssize' % format_id
)
136 'url': 'rtmp://media.ntv.ru/%s' % app
,
138 'play_path': file.text
,
140 'player_url': 'http://www.ntv.ru/swf/vps1.swf?update=20131128',
141 'page_url': 'http://www.ntv.ru',
142 'flash_ver': 'LNX 11,2,202,341',
145 'filesize': int(size
.text
),
147 self
._sort
_formats
(formats
)
152 'description': description
,
153 'thumbnail': thumbnail
,
154 'duration': duration
,
155 'view_count': view_count
,