From: Roland Häder Date: Tue, 11 Jul 2023 12:26:58 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=67787fe920f92af3a2a8df808fe3999e87104c26;p=fba.git Continued: - need to find all, not just first element ... --- diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index 238f673..3d99838 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -152,23 +152,22 @@ 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"]) - - 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) - - if content is None: - logger.debug("domain='%s' has returned empty header='%s' - SKIPPED!", domain, header) - continue - elif not isinstance(content, str): - logger.debug("content[]='%s' is not supported/wanted type 'str' - SKIPPED!", type(content)) - continue - elif content.lower() in translations: - logger.debug("Found header with blocked instances - BREAK!") - found = header - break + for content in header.find_all(["h2", "h3", "h4", "h5"]): + logger.debug("content[%s]='%s' - BEFORE!", type(content), content) + if content is not None: + content = str(content.contents[0]) + logger.debug("content[%s]='%s' - AFTER!", type(content), content) + + if content is None: + logger.debug("domain='%s' has returned empty header='%s' - SKIPPED!", domain, header) + continue + elif not isinstance(content, str): + logger.debug("content[]='%s' is not supported/wanted type 'str' - SKIPPED!", type(content)) + continue + elif content.lower() in translations: + logger.debug("Found header with blocked instances - BREAK!") + found = header + break logger.debug("found[]='%s'", type(found)) if found is None: