From 5727c2437597b73eee932b1be41f0cb452c189a1 Mon Sep 17 00:00:00 2001 From: Mint <> Date: Sun, 7 Aug 2022 14:17:12 +0300 Subject: [PATCH] Fix (?) for yet more duplicate uppercase entries --- api.py | 2 +- fetch_blocks.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api.py b/api.py index f099755..ee08cb5 100644 --- a/api.py +++ b/api.py @@ -38,7 +38,7 @@ def blocked(domain: str = None, reason: str = None): c = conn.cursor() if domain != None: wildchar = "*." + ".".join(domain.split(".")[-domain.count("."):]) - c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ?", (domain, "*."+domain, wildchar, get_hash(domain))) + c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ?", (domain, "*." + domain, wildchar, get_hash(domain))) else: c.execute("select * from blocks where reason like ? and reason != ''", ("%"+reason+"%",)) blocks = c.fetchall() diff --git a/fetch_blocks.py b/fetch_blocks.py index 104a79e..c178faf 100644 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -44,7 +44,7 @@ def get_mastodon_blocks(domain: str) -> dict: if header_text in blocks: blocks[header_text].append( { - "domain": line.find("span").text.lower(), + "domain": line.find("span").text, "hash": line.find("span")["title"][9:], "reason": line.find_all("td")[1].text.strip(), } @@ -145,6 +145,7 @@ for blocker, software in c.fetchall(): json = get_mastodon_blocks(blocker) for block_level, blocks in json.items(): for instance in blocks: + blocked == blocked.lower() blocked, blocked_hash, reason = instance.values() if blocked.count("*") <= 1: c.execute(