if blocker == "":
print("WARNING: blocker is now empty!")
continue
+ elif nodeinfo_url is None or nodeinfo_url == "":
+ print(f"DEBUG: blocker='{blocker}',software='{software}' has empty nodeinfo_url")
+ continue
elif blacklist.is_blacklisted(blocker):
print(f"WARNING: blocker='{blocker}' is blacklisted now!")
continue
mastodon.fetch_blocks(blocker, origin, nodeinfo_url)
elif software == "lemmy":
print(f"INFO: blocker='{blocker}',software='{software}'")
- lemmy.fetch_blocks(blocker, origin, nodeinfo_url)
+ #lemmy.fetch_blocks(blocker, origin, nodeinfo_url)
elif software == "friendica" or software == "misskey":
print(f"INFO: blocker='{blocker}',software='{software}'")
print(f"INFO: Fetching {len(types)} different table data ...")
for software in types:
- # DEBUG: print(f"DEBUG: Fetching table data for software='{software}' ...")
- raw = fba.fetch_url(f"https://fediverse.observer/app/views/tabledata.php?software={software}", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout"))).text
- # DEBUG: print(f"DEBUG: raw[{type(raw)}]()={len(raw)}")
+ doc = None
+
+ try:
+ # DEBUG: print(f"DEBUG: Fetching table data for software='{software}' ...")
+ raw = fba.fetch_url(f"https://fediverse.observer/app/views/tabledata.php?software={software}", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout"))).text
+ # DEBUG: print(f"DEBUG: raw[{type(raw)}]()={len(raw)}")
- doc = bs4.BeautifulSoup(raw, features='html.parser')
- # DEBUG: print(f"DEBUG: doc[]='{type(doc)}'")
+ doc = bs4.BeautifulSoup(raw, features='html.parser')
+ # DEBUG: print(f"DEBUG: doc[]='{type(doc)}'")
+ except network.exceptions as exception:
+ print(f"WARNING: Cannot fetch software='{software}' from fediverse.observer: '{type(exception)}'")
+ continue
items = doc.findAll("a", {"class": "url"})
print(f"INFO: Checking {len(items)} items,software='{software}' ...")
continue
print(f"INFO: Fetching instances for domain='{domain}',software='{software}'")
- federation.fetch_instances(domain, None, software, inspect.currentframe().f_code.co_name)
+ federation.fetch_instances(domain, None, None, inspect.currentframe().f_code.co_name)
# DEBUG: print("DEBUG: EXIT!")
return
elif not validators.domain(domain.split("/")[0]):
raise ValueError(f"domain='{domain}' is not a valid domain")
+ elif domain.endswith(".tld"):
+ raise ValueError(f"domain='{domain}' is a fake domain")
if not instances.is_registered(domain):
# DEBUG: print(f"DEBUG: Adding new domain='{domain}',origin='{origin}',command='{command}',path='{path}',software='{software}'")
# DEBUG: print(f"DEBUG: fba.cursor.rowcount={fba.cursor.rowcount}")
if fba.cursor.rowcount == 0:
- raise Exception(f"Did not update any rows: domain='{domain}',fields()={len(fields)}")
+ raise Exception(f"Did not update any rows: blocker='{blocker}'")
# DEBUG: print("DEBUG: EXIT!")
# DEBUG: print(f"DEBUG: fba.cursor.rowcount={fba.cursor.rowcount}")
if fba.cursor.rowcount == 0:
- raise Exception(f"Did not update any rows: domain='{domain}',fields()={len(fields)}")
+ raise Exception(f"Did not update any rows: blocker='{blocker}'")
# DEBUG: print("DEBUG: EXIT!")