[tiktok] fix "KeyError: 'author'" (#8189)
This commit is contained in:
@@ -42,8 +42,7 @@ class TiktokExtractor(Extractor):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
post = video_detail["itemInfo"]["itemStruct"]
|
post = video_detail["itemInfo"]["itemStruct"]
|
||||||
author = post["author"]
|
post["user"] = (a := post.get("author")) and a["uniqueId"] or ""
|
||||||
post["user"] = author["uniqueId"]
|
|
||||||
post["date"] = text.parse_timestamp(post["createTime"])
|
post["date"] = text.parse_timestamp(post["createTime"])
|
||||||
original_title = title = post["desc"]
|
original_title = title = post["desc"]
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,13 @@ __tests__ = (
|
|||||||
"#class" : tiktok.TiktokPostExtractor,
|
"#class" : tiktok.TiktokPostExtractor,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://www.tiktok.com/@veronicaperasso_1/video/7212008840433274118",
|
||||||
|
"#comment" : "no 'author' (#8189)",
|
||||||
|
"#class" : tiktok.TiktokPostExtractor,
|
||||||
|
"#results" : "ytdl:https://www.tiktok.com/@veronicaperasso_1/video/7212008840433274118",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://vm.tiktok.com/ZGdh4WUhr/",
|
"#url" : "https://vm.tiktok.com/ZGdh4WUhr/",
|
||||||
"#comment" : "vm.tiktok.com link: many photos",
|
"#comment" : "vm.tiktok.com link: many photos",
|
||||||
|
|||||||
Reference in New Issue
Block a user