mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-30 22:24:28 +01:00
[ntv] Simplify
This commit is contained in:
parent
b8b01bb92a
commit
50fc59968e
1 changed files with 19 additions and 27 deletions
|
@ -89,24 +89,16 @@ class NTVIE(InfoExtractor):
|
||||||
_VIDEO_ID_REGEXES = [
|
_VIDEO_ID_REGEXES = [
|
||||||
r'<meta property="og:url" content="http://www\.ntv\.ru/video/(\d+)',
|
r'<meta property="og:url" content="http://www\.ntv\.ru/video/(\d+)',
|
||||||
r'<video embed=[^>]+><id>(\d+)</id>',
|
r'<video embed=[^>]+><id>(\d+)</id>',
|
||||||
r'<video restriction[^>]+><key>(\d+)</key>'
|
r'<video restriction[^>]+><key>(\d+)</key>',
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
page = self._download_webpage(url, video_id, 'Downloading page')
|
page = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
for pattern in self._VIDEO_ID_REGEXES:
|
video_id = self._html_search_regex(self._VIDEO_ID_REGEXES, page, 'video id')
|
||||||
mobj = re.search(pattern, page)
|
|
||||||
if mobj:
|
|
||||||
break
|
|
||||||
|
|
||||||
if not mobj:
|
|
||||||
raise ExtractorError('No media links available for %s' % video_id)
|
|
||||||
|
|
||||||
video_id = mobj.group(1)
|
|
||||||
|
|
||||||
player = self._download_xml('http://www.ntv.ru/vi%s/' % video_id, video_id, 'Downloading video XML')
|
player = self._download_xml('http://www.ntv.ru/vi%s/' % video_id, video_id, 'Downloading video XML')
|
||||||
title = unescapeHTML(player.find('./data/title').text)
|
title = unescapeHTML(player.find('./data/title').text)
|
||||||
|
@ -124,7 +116,7 @@ class NTVIE(InfoExtractor):
|
||||||
'7': 'video2',
|
'7': 'video2',
|
||||||
}
|
}
|
||||||
|
|
||||||
app = apps[puid22] if puid22 in apps else apps['4']
|
app = apps.get(puid22, apps['4'])
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for format_id in ['', 'hi', 'webm']:
|
for format_id in ['', 'hi', 'webm']:
|
||||||
|
|
Loading…
Reference in a new issue