1
0
Fork 0
mirror of https://codeberg.org/polarisfm/youtube-dl.git synced 2024-12-23 08:12:28 +00:00

[uol] fix format url extraction(closes 18480)

This commit is contained in:
Remita Amine 2018-12-10 14:59:57 +01:00
parent 102a4e54c5
commit 13e17cd28e

View file

@ -61,7 +61,7 @@ class UOLIE(InfoExtractor):
'height': 360, 'height': 360,
}, },
'5': { '5': {
'width': 1080, 'width': 1280,
'height': 720, 'height': 720,
}, },
'6': { '6': {
@ -80,6 +80,10 @@ class UOLIE(InfoExtractor):
'width': 568, 'width': 568,
'height': 320, 'height': 320,
}, },
'11': {
'width': 640,
'height': 360,
}
} }
def _real_extract(self, url): def _real_extract(self, url):
@ -111,19 +115,31 @@ class UOLIE(InfoExtractor):
'ver': video_data.get('numRevision', 2), 'ver': video_data.get('numRevision', 2),
'r': 'http://mais.uol.com.br', 'r': 'http://mais.uol.com.br',
} }
for k in ('token', 'sign'):
v = video_data.get(k)
if v:
query[k] = v
formats = [] formats = []
for f in video_data.get('formats', []): for f in video_data.get('formats', []):
f_url = f.get('url') or f.get('secureUrl') f_url = f.get('url') or f.get('secureUrl')
if not f_url: if not f_url:
continue continue
f_url = update_url_query(f_url, query)
format_id = str_or_none(f.get('id')) format_id = str_or_none(f.get('id'))
if format_id == '10':
formats.extend(self._extract_m3u8_formats(
f_url, video_id, 'mp4', 'm3u8_native',
m3u8_id='hls', fatal=False))
continue
fmt = { fmt = {
'format_id': format_id, 'format_id': format_id,
'url': update_url_query(f_url, query), 'url': f_url,
'source_preference': 1,
} }
fmt.update(self._FORMATS.get(format_id, {})) fmt.update(self._FORMATS.get(format_id, {}))
formats.append(fmt) formats.append(fmt)
self._sort_formats(formats) self._sort_formats(formats, ('height', 'width', 'source_preference', 'tbr', 'ext'))
tags = [] tags = []
for tag in video_data.get('tags', []): for tag in video_data.get('tags', []):