[kakao] remove raw request and extract format total bitrate

This commit is contained in:
Remita Amine 2019-11-01 12:40:41 +01:00
parent d439989215
commit e987ce4bda

View File

@ -69,7 +69,8 @@ def _real_extract(self, url):
'-*', 'tid', 'clipLink', 'displayTitle', 'clip', 'title', '-*', 'tid', 'clipLink', 'displayTitle', 'clip', 'title',
'description', 'channelId', 'createTime', 'duration', 'playCount', 'description', 'channelId', 'createTime', 'duration', 'playCount',
'likeCount', 'commentCount', 'tagList', 'channel', 'name', 'likeCount', 'commentCount', 'tagList', 'channel', 'name',
'clipChapterThumbnailList', 'thumbnailUrl', 'timeInSec', 'isDefault']) 'clipChapterThumbnailList', 'thumbnailUrl', 'timeInSec', 'isDefault',
'videoOutputList', 'width', 'height', 'kbps', 'profile', 'label'])
} }
impress = self._download_json( impress = self._download_json(
@ -81,21 +82,14 @@ def _real_extract(self, url):
title = clip.get('title') or clip_link.get('displayTitle') title = clip.get('title') or clip_link.get('displayTitle')
tid = impress.get('tid', '') query['tid'] = impress.get('tid', '')
query.update({
'fields': '-*,outputList,profile,width,height,label,filesize',
'tid': tid,
'profile': 'HIGH',
})
raw = self._download_json(
api_base + 'raw', display_id, 'Downloading video formats info',
query=query, headers=player_header)
formats = [] formats = []
for fmt in raw.get('outputList', []): for fmt in clip.get('videoOutputList', []):
try: try:
profile_name = fmt['profile'] profile_name = fmt['profile']
if profile_name == 'AUDIO':
continue
query.update({ query.update({
'profile': profile_name, 'profile': profile_name,
'fields': '-*,url', 'fields': '-*,url',
@ -115,7 +109,8 @@ def _real_extract(self, url):
'width': int_or_none(fmt.get('width')), 'width': int_or_none(fmt.get('width')),
'height': int_or_none(fmt.get('height')), 'height': int_or_none(fmt.get('height')),
'format_note': fmt.get('label'), 'format_note': fmt.get('label'),
'filesize': int_or_none(fmt.get('filesize')) 'filesize': int_or_none(fmt.get('filesize')),
'tbr': int_or_none(fmt.get('kbps')),
}) })
except KeyError: except KeyError:
pass pass