From 5d76bd7cc590dcc5b9ad4af860702da6714a62ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 11 Jul 2023 07:37:16 +0200 Subject: [PATCH] Continued: - nope, the returned 'blocking' list is differently structured --- fba/networks/lemmy.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index be1b12d..1306bb8 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -166,10 +166,20 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: logger.debug("found[]='%s'", type(found)) if found is None: logger.info("domain='%s' has no HTML blocklist, checking scripts ...", domain) - blocking = parse_script(doc, "blocked") - - logger.debug("blocking()=%d - EXIT!", len(blocking)) - return blocking + peers = parse_script(doc, "blocked") + + logger.debug("domain='%s' has %d peer(s).", domain, len(peers)) + for blocked in peers: + logger.debug("Appending blocker='%s',blocked='%s',block_level='reject' ...", domain, blocked) + blocklist.append({ + "blocker" : domain, + "blocked" : blocked, + "reason" : None, + "block_level": "reject", + }) + + logger.debug("blocklist()=%d - EXIT!", len(blocklist)) + return blocklist blocking = found.find_next(["ul","table"]).findAll("a") logger.debug("Found %d blocked instance(s) ...", len(blocking)) -- 2.39.5