1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

[tele13] split long lines

This commit is contained in:
remitamine 2015-12-29 15:02:18 +01:00
parent f2017cb020
commit 98d7c0f4f7

View File

@ -46,8 +46,12 @@ def _real_extract(self, url):
display_id = self._match_id(url) display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
setup_js = self._search_regex(r"(?s)jwplayer\('player-vivo'\).setup\((\{.*?\})\)", webpage, 'setup code') setup_js = self._search_regex(
sources = self._parse_json(self._search_regex(r'sources\s*:\s*(\[[^\]]+\])', setup_js, 'sources'), display_id, js_to_json) r"(?s)jwplayer\('player-vivo'\).setup\((\{.*?\})\)",
webpage, 'setup code')
sources = self._parse_json(self._search_regex(
r'sources\s*:\s*(\[[^\]]+\])', setup_js, 'sources'),
display_id, js_to_json)
preference = qualities(['Móvil', 'SD', 'HD']) preference = qualities(['Móvil', 'SD', 'HD'])
formats = [] formats = []
@ -57,7 +61,9 @@ def _real_extract(self, url):
if format_url and format_url not in urls: if format_url and format_url not in urls:
ext = determine_ext(format_url) ext = determine_ext(format_url)
if ext == 'm3u8': if ext == 'm3u8':
formats.extend(self._extract_m3u8_formats(format_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) formats.extend(self._extract_m3u8_formats(
format_url, display_id, 'mp4', 'm3u8_native',
m3u8_id='hls', fatal=False))
elif YoutubeIE.suitable(format_url): elif YoutubeIE.suitable(format_url):
return self.url_result(format_url, 'Youtube') return self.url_result(format_url, 'Youtube')
else: else:
@ -72,8 +78,11 @@ def _real_extract(self, url):
return { return {
'id': display_id, 'id': display_id,
'title': self._search_regex(r'title\s*:\s*"([^"]+)"', setup_js, 'title'), 'title': self._search_regex(
'description': self._html_search_meta('description', webpage, 'description'), r'title\s*:\s*"([^"]+)"', setup_js, 'title'),
'thumbnail': self._search_regex(r'image\s*:\s*"([^"]+)"', setup_js, 'thumbnail', default=None), 'description': self._html_search_meta(
'description', webpage, 'description'),
'thumbnail': self._search_regex(
r'image\s*:\s*"([^"]+)"', setup_js, 'thumbnail', default=None),
'formats': formats, 'formats': formats,
} }