From 492ea46c25aa76249cd10a48a3c0e2896ca38a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 1 Apr 2025 08:48:53 +0200 Subject: [PATCH] [zerochan] fix "KeyError: 'author'" (#7282) fixes regression introduced in d746e025a0823b5bb04e645bb58c7d1abce013ae --- gallery_dl/extractor/zerochan.py | 6 +++++- test/results/zerochan.py | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/zerochan.py b/gallery_dl/extractor/zerochan.py index ac1400e1..0ad73c05 100644 --- a/gallery_dl/extractor/zerochan.py +++ b/gallery_dl/extractor/zerochan.py @@ -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"', '

').rpartition("")[2])), } + try: + data["author"] = jsonld["author"]["name"] + except Exception: + data["author"] = "" + html = data["tags"] tags = data["tags"] = [] for tag in html.split("