mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 02:25:11 +00:00
[letv] Reduce duplicated codes
This commit is contained in:
parent
78be2eca7c
commit
10defdd06a
1 changed files with 11 additions and 8 deletions
|
@ -281,14 +281,17 @@ def _real_extract(self, url):
|
|||
"uu=" + uu + "&vu=" + vu)
|
||||
play_json = self._download_json(play_json_req, media_id, 'Downloading playJson data')
|
||||
|
||||
formats = [{
|
||||
'url': base64.b64decode(media['play_url']['main_url'].encode('utf-8')).decode("utf-8"),
|
||||
'ext': 'mp4',
|
||||
'format_id': int_or_none(media.get('play_url', {}).get('vtype')),
|
||||
'format_note': str_or_none(media.get('play_url', {}).get('definition')),
|
||||
'width': int_or_none(media.get('play_url', {}).get('vwidth')),
|
||||
'height': int_or_none(media.get('play_url', {}).get('vheight')),
|
||||
} for media in play_json['data']['video_info']['media'].values()]
|
||||
formats = []
|
||||
for media in play_json['data']['video_info']['media'].values():
|
||||
play_url = media['play_url']
|
||||
formats.append({
|
||||
'url': base64.b64decode(play_url['main_url'].encode('utf-8')).decode("utf-8"),
|
||||
'ext': 'mp4',
|
||||
'format_id': int_or_none(play_url.get('vtype')),
|
||||
'format_note': str_or_none(play_url.get('definition')),
|
||||
'width': int_or_none(play_url.get('vwidth')),
|
||||
'height': int_or_none(play_url.get('vheight')),
|
||||
})
|
||||
self._sort_formats(formats)
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue