[scripts/generate_result] fix 'small()' for empty objects
This commit is contained in:
@@ -181,6 +181,8 @@ def sort_key(key, value):
|
|||||||
|
|
||||||
|
|
||||||
def small(obj):
|
def small(obj):
|
||||||
|
if not obj:
|
||||||
|
return True
|
||||||
if isinstance(obj, list):
|
if isinstance(obj, list):
|
||||||
return False if len(obj) > 1 else small(obj[0])
|
return False if len(obj) > 1 else small(obj[0])
|
||||||
if isinstance(obj, dict):
|
if isinstance(obj, dict):
|
||||||
|
|||||||
@@ -66,13 +66,24 @@ __tests__ = (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://www.bilibili.com/opus/1154738799821979656",
|
"#url" : "https://www.bilibili.com/opus/1154738799821979656",
|
||||||
"#comment": "livephoto (#8860)",
|
"#comment" : "livephoto (#8860)",
|
||||||
"#class" : bilibili.BilibiliArticleExtractor,
|
"#class" : bilibili.BilibiliArticleExtractor,
|
||||||
"#results": (
|
"#results" : (
|
||||||
"http://i0.hdslb.com/bfs/new_dyn/live_958a5cffe9177b196ada011867abd0a031968078.jpg",
|
"http://i0.hdslb.com/bfs/new_dyn/live_958a5cffe9177b196ada011867abd0a031968078.jpg",
|
||||||
"https://i0.hdslb.com/bfs/dyn_video/_000003lud8wlka5eq2kxctgfx3fwo3b-1-152111110022.mp4",
|
"https://i0.hdslb.com/bfs/dyn_video/_000003lud8wlka5eq2kxctgfx3fwo3b-1-152111110022.mp4",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
"extension" : {"jpg", "mp4"},
|
||||||
|
"width" : 4096,
|
||||||
|
"height" : 3072,
|
||||||
|
"id" : {"1154738799821979656", "1154738799821979656_l"},
|
||||||
|
"isPreview" : False,
|
||||||
|
"live_url" : "https://i0.hdslb.com/bfs/dyn_video/_000003lud8wlka5eq2kxctgfx3fwo3b-1-152111110022.mp4",
|
||||||
|
"modern" : True,
|
||||||
|
"theme" : "light",
|
||||||
|
"themeMode" : "light",
|
||||||
|
"username" : "粽子淞",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user