[BiliBili] change some dict key operation to get method
This commit is contained in:
parent
69f4e8db16
commit
c35bdd1b8e
@ -176,12 +176,12 @@ class BiliBiliIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
# new method, get value from json
|
# new method, get value from json
|
||||||
video_list = js['data']['View']['pages']
|
video_list = js['data']['View']['pages']
|
||||||
title = js['data']['View']['title']
|
title = js.get('data').get('View').get('title')
|
||||||
thumbnail = js['data']['View']['pic']
|
thumbnail = js['data']['View']['pic']
|
||||||
description = js['data']['View']['desc']
|
uploader_id = js.get('data').get('Card').get('card').get('mid')
|
||||||
uploader_id = js['data']['Card']['card']['mid']
|
description = js.get('data').get('View').get('desc')
|
||||||
uploader_name = js['data']['Card']['card']['name']
|
uploader_name = js.get('data').get('Card').get('card').get('name')
|
||||||
view_count = js['data']['View']['stat']['view']
|
view_count = js.get('data').get('View').get('stat').get('view')
|
||||||
self.to_screen("%s: video count: %d"%(original_video_id, len(video_list)))
|
self.to_screen("%s: video count: %d"%(original_video_id, len(video_list)))
|
||||||
part_list = [{'cid': x['cid'], 'title': x['part']} for x in video_list]
|
part_list = [{'cid': x['cid'], 'title': x['part']} for x in video_list]
|
||||||
headers = {
|
headers = {
|
||||||
@ -294,19 +294,14 @@ class BiliBiliIE(InfoExtractor):
|
|||||||
entry['view_count'] = view_count
|
entry['view_count'] = view_count
|
||||||
return entry
|
return entry
|
||||||
else:
|
else:
|
||||||
return {
|
playlist_entry = self.playlist_result(entries, id, title, description)
|
||||||
'_type': 'multi_video',
|
playlist_entry['uploader'] = uploader_name
|
||||||
'uploader': uploader_name,
|
playlist_entry['uploader_id'] = uploader_id
|
||||||
'uploader_id': uploader_id,
|
playlist_entry['timestamp'] = timestamp
|
||||||
'id': original_video_id,
|
playlist_entry['thumbnail'] = thumbnail
|
||||||
'title': title,
|
playlist_entry['upload_date'] = upload_date
|
||||||
'description': description,
|
playlist_entry['view_count'] = view_count
|
||||||
'thumbnail': thumbnail,
|
return playlist_entry
|
||||||
'timestamp': timestamp,
|
|
||||||
'upload_date': upload_date,
|
|
||||||
'view_count' : view_count,
|
|
||||||
'entries': entries,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class BiliBiliBangumiIE(InfoExtractor):
|
class BiliBiliBangumiIE(InfoExtractor):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user