mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-13 22:07:49 +08:00
[niconico] handle theoretical case where owner is True-ish non-dict
This commit is contained in:
parent
78331973ab
commit
772f15dc8a
@ -40,7 +40,7 @@ class NiconicoIE(InfoExtractor):
|
|||||||
'uploader': 'takuya0301',
|
'uploader': 'takuya0301',
|
||||||
'uploader_id': '2698420',
|
'uploader_id': '2698420',
|
||||||
'upload_date': '20131123',
|
'upload_date': '20131123',
|
||||||
'timestamp': 1385215162,
|
'timestamp': int, # timestamp is unstable
|
||||||
'description': '(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org',
|
'description': '(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org',
|
||||||
'duration': 33,
|
'duration': 33,
|
||||||
'view_count': int,
|
'view_count': int,
|
||||||
@ -115,8 +115,8 @@ class NiconicoIE(InfoExtractor):
|
|||||||
'skip': 'Requires an account',
|
'skip': 'Requires an account',
|
||||||
}, {
|
}, {
|
||||||
# "New" HTML5 video
|
# "New" HTML5 video
|
||||||
|
# md5 is unstable
|
||||||
'url': 'http://www.nicovideo.jp/watch/sm31464864',
|
'url': 'http://www.nicovideo.jp/watch/sm31464864',
|
||||||
'md5': '8b1d60d94c570858f98bfa47cc742400',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'sm31464864',
|
'id': 'sm31464864',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@ -416,7 +416,7 @@ class NiconicoIE(InfoExtractor):
|
|||||||
|
|
||||||
# Note: cannot use api_data.get('owner', {}) because owner may be set to "null"
|
# Note: cannot use api_data.get('owner', {}) because owner may be set to "null"
|
||||||
# in the JSON, which will cause None to be returned instead of {}.
|
# in the JSON, which will cause None to be returned instead of {}.
|
||||||
owner = api_data.get('owner') or {}
|
owner = try_get(api_data, lambda x: x.get('owner'), dict) or {}
|
||||||
uploader_id = get_video_info(['ch_id', 'user_id']) or owner.get('id')
|
uploader_id = get_video_info(['ch_id', 'user_id']) or owner.get('id')
|
||||||
uploader = get_video_info(['ch_name', 'user_nickname']) or owner.get('nickname')
|
uploader = get_video_info(['ch_name', 'user_nickname']) or owner.get('nickname')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user