]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 4 Sep 2023 22:44:32 +0000 (00:44 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 4 Sep 2023 22:44:32 +0000 (00:44 +0200)
- skip more empty/None strings

fba/networks/friendica.py
fba/networks/lemmy.py
fba/networks/mastodon.py
fba/networks/pleroma.py

index 317a8caf37ac078482e4f92282bb51b9ad16b5a5..13720934f9f9cf30524d884aa6df6b6cf9d2ed45 100644 (file)
@@ -85,10 +85,7 @@ def fetch_blocks(domain: str) -> list:
         reason  = tidyup.reason(line.find_all("td")[1].text)
         logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason)
 
-        if blocked is None:
-            logger.warning("blocked is empty - SKIPPED!")
-            continue
-        elif blocked == "":
+        if blocked is None or blocked == "":
             logger.warning("line[]='%s' returned empty blocked domain - SKIPPED!", type(line))
             continue
         elif not domain_helper.is_wanted(blocked):
index e37c2b800d08a59f6f4685326b522b031522b29a..ebbe9a1bb877d9cd1520307793d4050e8effb0a3 100644 (file)
@@ -203,10 +203,7 @@ def fetch_blocks(domain: str) -> list:
                 blocked = tidyup.domain(tag.contents[0]) if tag.contents[0] != "" else None
                 logger.debug("blocked='%s'", blocked)
 
-                if blocked is None:
-                    logger.warning("blocked is empty - SKIPPED!")
-                    continue
-                elif blocked == "":
+                if blocked is None or blocked == "":
                     logger.warning("blocked='%s' is empty after tidyup.domain() - SKIPPED!", tag.contents[0])
                     continue
                 elif not domain_helper.is_wanted(blocked):
@@ -272,11 +269,8 @@ def fetch_instances(domain: str, origin: str) -> list:
                         peer = tidyup.domain(text) if text != "" else None
                         logger.debug("peer='%s' - AFTER", peer)
 
-                        if peer is None:
-                            logger.warning("peer is empty - SKIPPED!")
-                            continue
-                        elif peer == "":
-                            logger.warning("peer is an empty string, text='%s' - SKIPPED!", text)
+                        if peer is None or peer == "":
+                            logger.warning("peer='%s' is empty, text='%s' - SKIPPED!", peer, text)
                             continue
                         elif not domain_helper.is_wanted(peer):
                             logger.debug("peer='%s' is not wanted - SKIPPED!", peer)
@@ -375,11 +369,8 @@ def parse_script(doc: bs4.BeautifulSoup, only: str = None) -> list:
                 peer = tidyup.domain(row["domain"])
                 logger.debug("peer='%s' - AFTER!", peer)
 
-                if peer is None:
-                    logger.warning("peer is empty - SKIPPED!")
-                    continue
-                elif peer == "":
-                    logger.warning("peer is an empty string, row[domain]='%s' - SKIPPED!", row["domain"])
+                if peer is None or peer == "":
+                    logger.warning("peer='%s' is empty, row[domain]='%s' - SKIPPED!", peer, row["domain"])
                     continue
                 elif not domain_helper.is_wanted(peer):
                     logger.debug("peer='%s' is not wanted - SKIPPED!", peer)
index 3b57892c8f307a1dbaf1527a67f8298e10ddb5af..f0de5de88b33a0217ec5b257f651eb7d1952006f 100644 (file)
@@ -124,11 +124,8 @@ def fetch_blocks_from_about(domain: str) -> dict:
                 reason = tidyup.reason(reason) if reason != "" else None
 
                 logger.debug("domain='%s',reason='%s' - AFTER!", domain, reason)
-                if domain is None:
-                    logger.warning("domain is empty,line='%s' - SKIPPED!", line)
-                    continue
-                elif domain == "":
-                    logger.warning("domain is an empty string,line='%s' - SKIPPED!", line)
+                if domain is None or domain == "":
+                    logger.warning("domain='%s' is empty,line='%s' - SKIPPED!", domain, line)
                     continue
 
                 logger.debug("Appending domain='%s',hash='%s',reason='%s' to blocklist header_text='%s' ...", domain, hash, reason, blocklist)
index 1a69c239a7d42d374f7da7968391c790b720a983..5f403b9931eb1698a1cea68d2d138c2e5da69ea9 100644 (file)
@@ -127,11 +127,8 @@ def fetch_blocks(domain: str) -> list:
                     blocked = tidyup.domain(blocked) if blocked != "" else None
                     logger.debug("blocked='%s' - AFTER!", blocked)
 
-                    if blocked is None:
-                        logger.warning("blocked is empty - SKIPPED!")
-                        continue
-                    elif blocked == "":
-                        logger.warning("blocked is an empty string after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", domain, block_level)
+                    if blocked is None or blocked == "":
+                        logger.warning("blocked='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", blocked, domain, block_level)
                         continue
 
                     logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
@@ -158,9 +155,9 @@ def fetch_blocks(domain: str) -> list:
         for blocked in data["quarantined_instances"]:
             logger.debug("blocked='%s' - BEFORE!", blocked)
             blocked = tidyup.domain(blocked) if blocked != "" else None
-            logger.debug("blocked='%s' - AFTER!", blocked)
 
-            if blocked == "":
+            logger.debug("blocked='%s' - AFTER!", blocked)
+            if blocked is None or blocked == "":
                 logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
                 continue
             elif not domain_helper.is_wanted(blocked):