From 584e30f2e441cd2509f03d9865ffa08e1ad54cef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 11 Jul 2023 08:22:04 +0200 Subject: [PATCH] Continued: - maybe does not contain any header at all? --- fba/networks/lemmy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index 18cf2c4..5700742 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -152,9 +152,13 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: logger.debug("Checking %d header(s) ...", len(headers)) for header in headers: logger.debug("header[]='%s'", type(header)) - content = header.find(["h2", "h3", "h4", "h5"]).contents[0] + content = header.find(["h2", "h3", "h4", "h5"]) + + logger.debug("content[%s]='%s' - BEFORE!", type(content), content) + if content is not None: + content = content.contents[0] + logger.debug("content[%s]='%s' - AFTER!", type(content), content) - logger.debug("content[%s]='%s'", type(content), content) if content is None: logger.debug("domain='%s' has returned empty header='%s' - SKIPPED!", domain, header) continue -- 2.39.5