]> git.mxchange.org Git - fba.git/commitdiff
Fix (?) for yet more duplicate uppercase entries
authorMint <>
Sun, 7 Aug 2022 11:17:12 +0000 (14:17 +0300)
committerMint <>
Sun, 7 Aug 2022 11:17:12 +0000 (14:17 +0300)
api.py
fetch_blocks.py

diff --git a/api.py b/api.py
index f099755bd68a91d7914d46136dd9207379e3c191..ee08cb55c49720e1c0d53bd86132243d271cc79f 100644 (file)
--- 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()
index 104a79e0e83bfb49513e7120a6b3439e18ddd902..c178fafd671aee9707a312f8f13e1347807e5cbe 100644 (file)
@@ -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(