[tvnow] Extract HD formats (closes #21201)

This commit is contained in:
Sergey M․ 2019-06-08 00:45:28 +07:00
parent 2efefddafd
commit e75220b11a
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -47,15 +47,23 @@ def url_repl(proto, suffix):
r'\.ism/(?:[^.]*\.(?:m3u8|mpd)|[Mm]anifest)', r'\.ism/(?:[^.]*\.(?:m3u8|mpd)|[Mm]anifest)',
'.ism/' + suffix, manifest_url)) '.ism/' + suffix, manifest_url))
def make_urls(proto, suffix):
urls = [url_repl(proto, suffix)]
hd_url = urls[0].replace('/manifest/', '/ngvod/')
if hd_url != urls[0]:
urls.append(hd_url)
return urls
for man_url in make_urls('dash', '.mpd'):
formats = self._extract_mpd_formats( formats = self._extract_mpd_formats(
url_repl('dash', '.mpd'), video_id, man_url, video_id, mpd_id='dash', fatal=False)
mpd_id='dash', fatal=False) for man_url in make_urls('hss', 'Manifest'):
formats.extend(self._extract_ism_formats( formats.extend(self._extract_ism_formats(
url_repl('hss', 'Manifest'), man_url, video_id, ism_id='mss', fatal=False))
video_id, ism_id='mss', fatal=False)) for man_url in make_urls('hls', '.m3u8'):
formats.extend(self._extract_m3u8_formats( formats.extend(self._extract_m3u8_formats(
url_repl('hls', '.m3u8'), video_id, 'mp4', man_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls',
'm3u8_native', m3u8_id='hls', fatal=False)) fatal=False))
if formats: if formats:
break break
else: else: