1 from bs4 import BeautifulSoup
2 from hashlib import sha256
12 with open("config.json") as f:
13 config = json.loads(f.read())
15 # Don't check these, known trolls/flooders/testing/developing
17 # Floods network with fake nodes as "research" project
18 "activitypub-troll.cf",
24 "social.shrimpcam.pw",
26 "mastotroll.netz.org",
27 # Testing/developing installations
31 # Array with pending errors needed to be written to database
35 # "rel" identifiers (no real URLs)
36 nodeinfo_identifier = [
37 "http://nodeinfo.diaspora.software/ns/schema/2.1",
38 "http://nodeinfo.diaspora.software/ns/schema/2.0",
39 "http://nodeinfo.diaspora.software/ns/schema/1.1",
40 "http://nodeinfo.diaspora.software/ns/schema/1.0",
43 # HTTP headers for requests
45 "user-agent": config["useragent"],
48 # Found info from node, such as nodeinfo URL, detection mode that needs to be
49 # written to database. Both arrays must be filled at the same time or else
50 # update_nodeinfos() will fail
52 # Detection mode: AUTO_DISCOVERY or STATIC_CHECKS
56 # Where to fetch peers (other instances)
60 # URL for fetching peers
61 get_peers_url = "/api/v1/instance/peers"
64 connection = sqlite3.connect("blocks.db")
65 cursor = connection.cursor()
67 def is_blacklisted(domain: str) -> bool:
69 for peer in blacklist:
75 def get_hash(domain: str) -> str:
76 return sha256(domain.encode("utf-8")).hexdigest()
78 def update_last_blocked(domain: str):
79 # NOISY-DEBUG: print("DEBUG: Updating last_blocked for domain", domain)
81 cursor.execute("UPDATE instances SET last_blocked = ?, last_updated = ? WHERE domain = ? LIMIT 1", [
87 if cursor.rowcount == 0:
88 print("WARNING: Did not update any rows:", domain)
90 except BaseException as e:
91 print("ERROR: failed SQL query:", domain, e)
94 # NOISY-DEBUG: print("DEBUG: EXIT!")
96 def update_nodeinfos(domain: str):
97 # NOISY-DEBUG: print("DEBUG: Updating nodeinfo for domain:", domain)
100 for key in nodeinfos:
101 # NOISY-DEBUG: print("DEBUG: key:", key)
102 if domain in nodeinfos[key]:
103 # NOISY-DEBUG: print(f"DEBUG: Adding '{nodeinfos[key][domain]}' for key='{key}' ...")
104 fields.append(nodeinfos[key][domain])
105 sql_string += f" {key} = ?,"
107 sql_string = sql_string[:-1]
108 fields.append(domain)
109 # NOISY-DEBUG: print(f"DEBUG: sql_string='{sql_string}',fields()={len(fields)}")
111 sql = "UPDATE instances SET" + sql_string + " WHERE domain = ? LIMIT 1"
112 # NOISY-DEBUG: print("DEBUG: sql:", sql)
115 # NOISY-DEBUG: print("DEBUG: Executing SQL:", sql)
116 cursor.execute(sql, fields)
117 # NOISY-DEBUG: print(f"DEBUG: Success! (rowcount={cursor.rowcount })")
119 if cursor.rowcount == 0:
120 print("WARNING: Did not update any rows:", domain)
122 except BaseException as e:
123 print(f"ERROR: failed SQL query: domain='{domain}',sql='{sql}',exception='{e}'")
126 # NOISY-DEBUG: print("DEBUG: Deleting nodeinfos for domain:", domain)
127 for key in nodeinfos:
129 # NOISY-DEBUG: print("DEBUG: Deleting key:", key)
130 del nodeinfos[key][domain]
134 # NOISY-DEBUG: print("DEBUG: EXIT!")
136 def update_last_error(domain: str, res: any):
137 # NOISY-DEBUG: print("DEBUG: domain,res[]:", domain, type(res))
139 # NOISY-DEBUG: print("DEBUG: BEFORE res[]:", type(res))
140 if isinstance(res, BaseException) or isinstance(res, json.JSONDecodeError):
143 # NOISY-DEBUG: print("DEBUG: AFTER res[]:", type(res))
145 # NOISY-DEBUG: print(f"DEBUG: Setting last_error_details='{res}'");
146 cursor.execute("UPDATE instances SET last_status_code = 999, last_error_details = ?, last_updated = ? WHERE domain = ? LIMIT 1", [
152 # NOISY-DEBUG: print(f"DEBUG: Setting last_error_details='{res.reason}'");
153 cursor.execute("UPDATE instances SET last_status_code = ?, last_error_details = ?, last_updated = ? WHERE domain = ? LIMIT 1", [
160 if cursor.rowcount == 0:
161 # NOISY-DEBUG: print("DEBUG: Did not update any rows:", domain)
162 pending_errors[domain] = res
164 except BaseException as e:
165 print("ERROR: failed SQL query:", domain, e)
168 # NOISY-DEBUG: print("DEBUG: EXIT!")
170 def update_last_nodeinfo(domain: str):
171 # NOISY-DEBUG: print("DEBUG: Updating last_nodeinfo for domain:", domain)
173 cursor.execute("UPDATE instances SET last_nodeinfo = ?, last_updated = ? WHERE domain = ? LIMIT 1", [
179 if cursor.rowcount == 0:
180 print("WARNING: Did not update any rows:", domain)
182 except BaseException as e:
183 print("ERROR: failed SQL query:", domain, e)
187 # NOISY-DEBUG: print("DEBUG: EXIT!")
189 def get_peers(domain: str, software: str) -> list:
190 # NOISY-DEBUG: print("DEBUG: Getting peers for domain:", domain, software)
193 if software == "lemmy":
194 # NOISY-DEBUG: print(f"DEBUG: domain='{domain}' is Lemmy. fetching JSON ...")
196 res = reqto.get(f"https://{domain}/api/v3/site", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
198 if res.ok and isinstance(res.json(), dict):
199 # NOISY-DEBUG: print("DEBUG: Success, res.json():", len(res.json()))
202 if "federated_instances" in json and "linked" in json["federated_instances"]:
203 # NOISY-DEBUG: print("DEBUG: Found federated_instances", domain)
204 peers = json["federated_instances"]["linked"] + json["federated_instances"]["allowed"] + json["federated_instances"]["blocked"]
206 except BaseException as e:
207 print("WARNING: Exception during fetching JSON:", domain, e)
209 update_last_nodeinfo(domain)
211 # NOISY-DEBUG: print("DEBUG: Returning peers[]:", type(peers))
215 res = reqto.get(f"https://{domain}/api/v1/instance/peers", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
217 if not res.ok or res.status_code >= 400:
218 res = reqto.get(f"https://{domain}/api/v3/site", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
220 if "federated_instances" in json and "linked" in json["federated_instances"]:
221 # NOISY-DEBUG: print("DEBUG: Found federated_instances", domain)
222 peers = json["federated_instances"]["linked"] + json["federated_instances"]["allowed"] + json["federated_instances"]["blocked"]
224 print("WARNING: Could not reach any JSON API:", domain)
225 update_last_error(domain, res)
227 # NOISY-DEBUG: print("DEBUG: Querying API was successful:", domain, len(res.json()))
229 nodeinfos["get_peers_url"][domain] = get_peers_url
231 except BaseException as e:
232 print("WARNING: Some error during get():", domain, e)
233 update_last_error(domain, e)
235 update_last_nodeinfo(domain)
237 # NOISY-DEBUG: print("DEBUG: Returning peers[]:", type(peers))
240 def post_json_api(domain: str, path: str, data: str) -> list:
241 # NOISY-DEBUG: print("DEBUG: Sending POST to domain,path,data:", domain, path, data)
244 res = reqto.post(f"https://{domain}{path}", data=data, headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
246 if not res.ok or res.status_code >= 400:
247 print("WARNING: Cannot query JSON API:", domain, path, data, res.status_code)
248 update_last_error(domain, res)
251 update_last_nodeinfo(domain)
253 except BaseException as e:
254 print("WARNING: Some error during post():", domain, path, data, e)
256 # NOISY-DEBUG: print("DEBUG: Returning json():", len(json))
259 def fetch_nodeinfo(domain: str) -> list:
260 # NOISY-DEBUG: print("DEBUG: Fetching nodeinfo from domain:", domain)
262 nodeinfo = fetch_wellknown_nodeinfo(domain)
263 # NOISY-DEBUG: print("DEBUG: nodeinfo:", len(nodeinfo))
265 if len(nodeinfo) > 0:
266 # NOISY-DEBUG: print("DEBUG: Returning auto-discovered nodeinfo:", len(nodeinfo))
270 f"https://{domain}/nodeinfo/2.1.json",
271 f"https://{domain}/nodeinfo/2.1",
272 f"https://{domain}/nodeinfo/2.0.json",
273 f"https://{domain}/nodeinfo/2.0",
274 f"https://{domain}/nodeinfo/1.0",
275 f"https://{domain}/api/v1/instance"
279 for request in requests:
281 # NOISY-DEBUG: print("DEBUG: Fetching request:", request)
282 res = reqto.get(request, headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
284 # NOISY-DEBUG: print("DEBUG: res.ok,res.json[]:", res.ok, type(res.json()))
285 if res.ok and isinstance(res.json(), dict):
286 # NOISY-DEBUG: print("DEBUG: Success:", request)
288 nodeinfos["detection_mode"][domain] = "STATIC_CHECK"
289 nodeinfos["nodeinfo_url"][domain] = request
291 elif not res.ok or res.status_code >= 400:
292 print("WARNING: Failed fetching nodeinfo from domain:", domain)
293 update_last_error(domain, res)
296 except BaseException as e:
297 # NOISY-DEBUG: print("DEBUG: Cannot fetch API request:", request)
298 update_last_error(domain, e)
301 # NOISY-DEBUG: print("DEBUG: json[]:", type(json))
302 if not isinstance(json, dict) or len(json) == 0:
303 print("WARNING: Failed fetching nodeinfo from domain:", domain)
305 # NOISY-DEBUG: print("DEBUG: Returning json[]:", type(json))
308 def fetch_wellknown_nodeinfo(domain: str) -> list:
309 # NOISY-DEBUG: print("DEBUG: Fetching .well-known info for domain:", domain)
313 res = reqto.get(f"https://{domain}/.well-known/nodeinfo", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"]))
314 # NOISY-DEBUG: print("DEBUG: domain,res.ok,res.json[]:", domain, res.ok, type(res.json()))
315 if res.ok and isinstance(res.json(), dict):
316 nodeinfo = res.json()
317 # NOISY-DEBUG: print("DEBUG: Found entries:", len(nodeinfo), domain)
318 if "links" in nodeinfo:
319 # NOISY-DEBUG: print("DEBUG: Found links in nodeinfo():", len(nodeinfo["links"]))
320 for link in nodeinfo["links"]:
321 # NOISY-DEBUG: print("DEBUG: rel,href:", link["rel"], link["href"])
322 if link["rel"] in nodeinfo_identifier:
323 # NOISY-DEBUG: print("DEBUG: Fetching nodeinfo from:", link["href"])
324 res = reqto.get(link["href"])
325 # NOISY-DEBUG: print("DEBUG: href,res.ok,res.status_code:", link["href"], res.ok, res.status_code)
326 if res.ok and isinstance(res.json(), dict):
327 # NOISY-DEBUG: print("DEBUG: Found JSON nodeinfo():", len(res.json()))
329 nodeinfos["detection_mode"][domain] = "AUTO_DISCOVERY"
330 nodeinfos["nodeinfo_url"][domain] = link["href"]
333 print("WARNING: Unknown 'rel' value:", domain, link["rel"])
335 print("WARNING: nodeinfo does not contain 'links':", domain)
337 except BaseException as e:
338 print("WARNING: Failed fetching .well-known info:", domain)
339 update_last_error(domain, e)
342 # NOISY-DEBUG: print("DEBUG: Returning json[]:", type(json))
345 def determine_software(domain: str) -> str:
346 # NOISY-DEBUG: print("DEBUG: Determining software for domain:", domain)
349 json = fetch_nodeinfo(domain)
350 # NOISY-DEBUG: print("DEBUG: json[]:", type(json))
352 if not isinstance(json, dict) or len(json) == 0:
353 # NOISY-DEBUG: print("DEBUG: Could not determine software type:", domain)
356 # NOISY-DEBUG: print("DEBUG: json():", len(json), json)
357 if "status" in json and json["status"] == "error" and "message" in json:
358 print("WARNING: JSON response is an error:", json["message"])
359 update_last_error(domain, json["message"])
361 elif "software" not in json or "name" not in json["software"]:
362 print("WARNING: JSON response does not include [software][name], guessing ...")
364 for element in {"uri", "title", "short_description", "description", "email", "version", "urls", "stats", "thumbnail", "languages", "contact_account", "registrations", "approval_required"}:
365 # NOISY-DEBUG: print("DEBUG: element:", element)
369 # NOISY-DEBUG: print("DEBUG: Found elements:", found)
370 if found == len(json):
371 # NOISY-DEBUG: print("DEBUG: Maybe is Mastodon:", domain)
374 print(f"WARNING: Cannot guess software type: domain='{domain}',found={found},json()={len(json)}")
377 software = tidyup(json["software"]["name"])
379 # NOISY-DEBUG: print("DEBUG: tidyup software:", software)
380 if software in ["akkoma", "rebased"]:
381 # NOISY-DEBUG: print("DEBUG: Setting pleroma:", domain, software)
383 elif software in ["hometown", "ecko"]:
384 # NOISY-DEBUG: print("DEBUG: Setting mastodon:", domain, software)
385 software = "mastodon"
386 elif software in ["calckey", "groundpolis", "foundkey", "cherrypick", "meisskey"]:
387 # NOISY-DEBUG: print("DEBUG: Setting misskey:", domain, software)
389 elif software.find("/") > 0:
390 print("WARNING: Spliting of path:", software)
391 software = software.split("/")[-1];
392 elif software.find("|") > 0:
393 print("WARNING: Spliting of path:", software)
394 software = software.split("|")[0].strip();
397 print("WARNING: tidyup() left no software name behind:", domain)
400 # NOISY-DEBUG: print("DEBUG: Returning domain,software:", domain, software)
403 def update_block_reason(reason: str, blocker: str, blocked: str, block_level: str):
404 # NOISY-DEBUG: print("DEBUG: Updating block reason:", reason, blocker, blocked, block_level)
407 "UPDATE blocks SET reason = ?, last_seen = ? WHERE blocker = ? AND blocked = ? AND block_level = ? AND reason = ''",
417 if cursor.rowcount == 0:
418 print("WARNING: Did not update any rows:", domain)
420 except BaseException as e:
421 print("ERROR: failed SQL query:", reason, blocker, blocked, block_level, e)
424 def update_last_seen(blocker: str, blocked: str, block_level: str):
425 # NOISY-DEBUG: print("DEBUG: Updating last_seen for:", blocker, blocked, block_level)
428 "UPDATE blocks SET last_seen = ? WHERE blocker = ? AND blocked = ? AND block_level = ?",
437 if cursor.rowcount == 0:
438 print("WARNING: Did not update any rows:", domain)
440 except BaseException as e:
441 print("ERROR: failed SQL query:", last_seen, blocker, blocked, block_level, e)
444 # NOISY-DEBUG: print("DEBUG: EXIT!")
446 def block_instance(blocker: str, blocked: str, reason: str, block_level: str):
447 # NOISY-DEBUG: print("DEBUG: blocker,blocked,reason,block_level:", blocker, blocked, reason, block_level)
448 if not validators.domain(blocker):
449 print("WARNING: Bad blocker:", blocker)
451 elif not validators.domain(blocked):
452 print("WARNING: Bad blocked:", blocked)
455 print("INFO: New block:", blocker, blocked, reason, block_level, first_added, last_seen)
458 "INSERT INTO blocks (blocker, blocked, reason, block_level, first_added, last_seen) VALUES(?, ?, ?, ?, ?, ?)",
469 except BaseException as e:
470 print("ERROR: failed SQL query:", blocker, blocked, reason, block_level, first_added, last_seen, e)
473 # NOISY-DEBUG: print("DEBUG: EXIT!")
475 def add_instance(domain: str, origin: str, originator: str):
476 # NOISY-DEBUG: print("DEBUG: domain,origin:", domain, origin, originator)
477 if not validators.domain(domain):
478 print("WARNING: Bad domain name:", domain)
480 elif origin is not None and not validators.domain(origin):
481 print("WARNING: Bad origin name:", origin)
484 software = determine_software(domain)
485 # NOISY-DEBUG: print("DEBUG: Determined software:", software)
487 print(f"INFO: Adding new instance {domain} (origin: {origin})")
490 "INSERT INTO instances (domain, origin, originator, hash, software, first_seen) VALUES (?, ?, ?, ?, ?, ?)",
501 if domain in nodeinfos["nodeinfo_url"]:
502 # NOISY-DEBUG # NOISY-DEBUG: print("DEBUG: domain has pending nodeinfo being updated:", domain)
503 update_nodeinfos(domain)
505 if domain in pending_errors:
506 # NOISY-DEBUG: print("DEBUG: domain has pending error being updated:", domain)
507 update_last_error(domain, pending_errors[domain])
508 del pending_errors[domain]
510 except BaseException as e:
511 print("ERROR: failed SQL query:", domain, e)
514 # NOISY-DEBUG: print("DEBUG: Updating nodeinfo for domain:", domain)
515 update_last_nodeinfo(domain)
517 # NOISY-DEBUG: print("DEBUG: EXIT!")
519 def send_bot_post(instance: str, blocks: dict):
520 message = instance + " has blocked the following instances:\n\n"
525 blocks = blocks[0 : 19]
528 if block["reason"] == None or block["reason"] == '':
529 message = message + block["blocked"] + " with unspecified reason\n"
531 if len(block["reason"]) > 420:
532 block["reason"] = block["reason"][0:419] + "[…]"
534 message = message + block["blocked"] + ' for "' + block["reason"].replace("@", "@\u200b") + '"\n'
537 message = message + "(the list has been truncated to the first 20 entries)"
539 botheaders = {**headers, **{"Authorization": "Bearer " + config["bot_token"]}}
541 req = reqto.post(f"{config['bot_instance']}/api/v1/statuses",
542 data={"status":message, "visibility":config['bot_visibility'], "content_type":"text/plain"},
543 headers=botheaders, timeout=10).json()
547 def get_mastodon_blocks(domain: str) -> dict:
548 # NOISY-DEBUG: print("DEBUG: Fetching mastodon blocks from domain:", domain)
550 "Suspended servers": [],
551 "Filtered media" : [],
552 "Limited servers" : [],
553 "Silenced servers" : [],
557 "Silenced instances" : "Silenced servers",
558 "Suspended instances" : "Suspended servers",
559 "Gesperrte Server" : "Suspended servers",
560 "Gefilterte Medien" : "Filtered media",
561 "Stummgeschaltete Server" : "Silenced servers",
562 "停止済みのサーバー" : "Suspended servers",
563 "制限中のサーバー" : "Limited servers",
564 "メディアを拒否しているサーバー": "Filtered media",
565 "サイレンス済みのサーバー" : "Silenced servers",
566 "שרתים מושעים" : "Suspended servers",
567 "מדיה מסוננת" : "Filtered media",
568 "שרתים מוגבלים" : "Silenced servers",
569 "Serveurs suspendus" : "Suspended servers",
570 "Médias filtrés" : "Filtered media",
571 "Serveurs limités" : "Limited servers",
572 "Serveurs modérés" : "Limited servers",
577 reqto.get(f"https://{domain}/about/more", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"])).text,
580 except BaseException as e:
581 print("ERROR: Cannot fetch from domain:", domain, e)
582 update_last_error(domain, e)
585 for header in doc.find_all("h3"):
586 header_text = header.text
588 if header_text in translations:
589 header_text = translations[header_text]
591 if header_text in blocks or header_text.lower() in blocks:
592 # replaced find_next_siblings with find_all_next to account for instances that e.g. hide lists in dropdown menu
593 for line in header.find_all_next("table")[0].find_all("tr")[1:]:
594 blocks[header_text].append(
596 "domain": tidyup(line.find("span").text),
597 "hash" : tidyup(line.find("span")["title"][9:]),
598 "reason": tidyup(line.find_all("td")[1].text),
602 # NOISY-DEBUG: print("DEBUG: Returning blocks for domain:", domain)
604 "reject" : blocks["Suspended servers"],
605 "media_removal" : blocks["Filtered media"],
606 "followers_only": blocks["Limited servers"] + blocks["Silenced servers"],
609 def get_friendica_blocks(domain: str) -> dict:
610 # NOISY-DEBUG: print("DEBUG: Fetching friendica blocks from domain:", domain)
615 reqto.get(f"https://{domain}/friendica", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"])).text,
618 except BaseException as e:
619 print("WARNING: Failed to fetch /friendica from domain:", domain, e)
620 update_last_error(domain, e)
623 blocklist = doc.find(id="about_blocklist")
625 # Prevents exceptions:
626 if blocklist is None:
627 # NOISY-DEBUG: print("DEBUG: Instance has no block list:", domain)
630 for line in blocklist.find("table").find_all("tr")[1:]:
632 "domain": tidyup(line.find_all("td")[0].text),
633 "reason": tidyup(line.find_all("td")[1].text)
636 # NOISY-DEBUG: print("DEBUG: Returning blocks() for domain:", domain, len(blocks))
641 def get_misskey_blocks(domain: str) -> dict:
642 # NOISY-DEBUG: print("DEBUG: Fetching misskey blocks from domain:", domain)
651 # iterating through all "suspended" (follow-only in its terminology)
652 # instances page-by-page, since that troonware doesn't support
653 # sending them all at once
656 # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
657 doc = post_json_api(domain, "/api/federation/instances/", json.dumps({
658 "sort" : "+caughtAt",
664 # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
665 doc = post_json_api(domain, "/api/federation/instances/", json.dumps({
666 "sort" : "+caughtAt",
673 # NOISY-DEBUG: print("DEBUG: doc():", len(doc))
675 # NOISY-DEBUG: print("DEBUG: Returned zero bytes, exiting loop:", domain)
680 if instance["isSuspended"]:
681 blocks["suspended"].append(
683 "domain": tidyup(instance["host"]),
684 # no reason field, nothing
690 # NOISY-DEBUG: print("DEBUG: End of request:", len(doc), step)
693 # NOISY-DEBUG: print("DEBUG: Raising counter by step:", step)
694 counter = counter + step
696 except BaseException as e:
697 print("WARNING: Caught error, exiting loop:", domain, e)
698 update_last_error(domain, e)
703 # same shit, different asshole ("blocked" aka full suspend)
706 # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
707 doc = post_json_api(domain,"/api/federation/instances", json.dumps({
708 "sort" : "+caughtAt",
714 # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter)
715 doc = post_json_api(domain,"/api/federation/instances", json.dumps({
716 "sort" : "+caughtAt",
723 # NOISY-DEBUG: print("DEBUG: doc():", len(doc))
725 # NOISY-DEBUG: print("DEBUG: Returned zero bytes, exiting loop:", domain)
729 if instance["isBlocked"]:
730 blocks["blocked"].append({
731 "domain": tidyup(instance["host"]),
736 # NOISY-DEBUG: print("DEBUG: End of request:", len(doc), step)
739 # NOISY-DEBUG: print("DEBUG: Raising counter by step:", step)
740 counter = counter + step
742 except BaseException as e:
743 print("ERROR: Exception during POST:", domain, e)
744 update_last_error(domain, e)
748 # NOISY-DEBUG: print("DEBUG: Returning for domain,blocked(),suspended():", domain, len(blocks["blocked"]), len(blocks["suspended"]))
750 "reject" : blocks["blocked"],
751 "followers_only": blocks["suspended"]
754 def tidyup(string: str) -> str:
755 # some retards put their blocks in variable case
756 string = string.lower().strip()
758 # other retards put the port
759 string = re.sub("\:\d+$", "", string)
761 # bigger retards put the schema in their blocklist, sometimes even without slashes
762 string = re.sub("^https?\:(\/*)", "", string)
765 string = re.sub("\/$", "", string)
768 string = re.sub("^\@", "", string)
770 # the biggest retards of them all try to block individual users
771 string = re.sub("(.+)\@", "", string)