from .common import InfoExtractor
from ..utils import (
- RegexNotFoundError,
unescapeHTML
)
'duration': 136,
},
'params': {
- # rtmp download
- 'skip_download': True,
- },
+ # rtmp download
+ 'skip_download': True,
+ },
},
{
'url': 'http://www.ntv.ru/video/novosti/750370/',
'duration': 172,
},
'params': {
- # rtmp download
- 'skip_download': True,
- },
+ # rtmp download
+ 'skip_download': True,
+ },
},
{
'url': 'http://www.ntv.ru/peredacha/segodnya/m23700/o232416',
'duration': 1496,
},
'params': {
- # rtmp download
- 'skip_download': True,
- },
+ # rtmp download
+ 'skip_download': True,
+ },
},
{
'url': 'http://www.ntv.ru/kino/Koma_film',
'info_dict': {
- 'id': '750783',
+ 'id': '758100',
'ext': 'flv',
- 'title': 'Остросюжетный фильм «Кома» \97 4 апреля вечером на НТВ',
- 'description': 'Остросюжетный фильм «Кома» \97 4 апреля вечером на НТВ',
- 'duration': 28,
+ 'title': 'Остросюжетный фильм «Кома»',
+ 'description': 'Остросюжетный фильм «Кома»',
+ 'duration': 5592,
},
'params': {
- # rtmp download
- 'skip_download': True,
- },
+ # rtmp download
+ 'skip_download': True,
+ },
},
{
'url': 'http://www.ntv.ru/serial/Delo_vrachey/m31760/o233916/',
'duration': 2590,
},
'params': {
- # rtmp download
- 'skip_download': True,
- },
+ # rtmp download
+ 'skip_download': True,
+ },
},
]
_VIDEO_ID_REGEXES = [
r'<meta property="og:url" content="http://www\.ntv\.ru/video/(\d+)',
r'<video embed=[^>]+><id>(\d+)</id>',
- r'<video restriction[^>]+><key>(\d+)</key>'
+ r'<video restriction[^>]+><key>(\d+)</key>',
]
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
- page = self._download_webpage(url, video_id, 'Downloading page')
-
- def extract(patterns, name, page, fatal=False):
- for pattern in patterns:
- mobj = re.search(pattern, page)
- if mobj:
- return mobj.group(1)
- if fatal:
- raise RegexNotFoundError(u'Unable to extract %s' % name)
- return None
+ page = self._download_webpage(url, video_id)
- video_id = extract(self._VIDEO_ID_REGEXES, 'video id', page, fatal=True)
+ video_id = self._html_search_regex(self._VIDEO_ID_REGEXES, page, 'video id')
player = self._download_xml('http://www.ntv.ru/vi%s/' % video_id, video_id, 'Downloading video XML')
title = unescapeHTML(player.find('./data/title').text)
'7': 'video2',
}
+ app = apps.get(puid22, apps['4'])
+
formats = []
for format_id in ['', 'hi', 'webm']:
file = video.find('./%sfile' % format_id)
if file is None:
continue
size = video.find('./%ssize' % format_id)
- app = apps[puid22] if puid22 in apps else apps['4']
formats.append({
'url': 'rtmp://media.ntv.ru/%s' % app,
'app': app,
'duration': duration,
'view_count': view_count,
'formats': formats,
- }
\ No newline at end of file
+ }