[zerochan] fix "KeyError: 'author'" (#7282)

fixes regression introduced in d746e025a0
This commit is contained in:
Mike Fährmann
2025-04-01 08:48:53 +02:00
parent fb6afb1ee1
commit 492ea46c25
2 changed files with 42 additions and 1 deletions

View File

@@ -74,7 +74,6 @@ class ZerochanExtractor(BooruExtractor):
extr = text.extract_from(page)
data = {
"id" : text.parse_int(entry_id),
"author" : jsonld["author"]["name"],
"file_url": jsonld["contentUrl"],
"date" : text.parse_datetime(jsonld["datePublished"]),
"width" : text.parse_int(jsonld["width"][:-3]),
@@ -88,6 +87,11 @@ class ZerochanExtractor(BooruExtractor):
'id="source-url"', '</p>').rpartition("</s>")[2])),
}
try:
data["author"] = jsonld["author"]["name"]
except Exception:
data["author"] = ""
html = data["tags"]
tags = data["tags"] = []
for tag in html.split("<li class=")[1:]: