]> git.mxchange.org Git - fba.git/commitdiff
Fix for instance detection
authorMint <>
Sat, 6 Aug 2022 15:19:26 +0000 (18:19 +0300)
committerMint <>
Sat, 6 Aug 2022 15:19:26 +0000 (18:19 +0300)
fetch_instances.py

index 726306acb7f3b54b3e45b8aaa5cc980a7c9cacb9..2d12351faefc307721592e087d1f548b9c0fb3c5 100644 (file)
@@ -24,20 +24,20 @@ def get_peers(domain: str) -> str:
 
 peerlist = get_peers(domain)
 
-def get_type(domain: str) -> str:
+def get_type(instdomain: str) -> str:
     try:
-        res = get(f"https://{domain}/nodeinfo/2.1.json", headers=headers, timeout=5)
+        res = get(f"https://{instdomain}/nodeinfo/2.1.json", headers=headers, timeout=5)
         if res.status_code == 404:
-            res = get(f"https://{domain}/nodeinfo/2.0.json", headers=headers, timeout=5)
+            res = get(f"https://{instdomain}/nodeinfo/2.0.json", headers=headers, timeout=5)
         if res.ok and "text/html" in res.headers["content-type"]:
-            res = get(f"https://{domain}/nodeinfo/2.1", headers=headers, timeout=5)
+            res = get(f"https://{instdomain}/nodeinfo/2.1", headers=headers, timeout=5)
         if res.ok:
             if res.json()["software"]["name"] == "akkoma":
                 return "pleroma"
             else:
                 return res.json()["software"]["name"]
         elif res.status_code == 404:
-            res = get(f"https://{domain}/api/v1/instance", headers=headers, timeout=5)
+            res = get(f"https://{instdomain}/api/v1/instance", headers=headers, timeout=5)
         if res.ok:
             return "mastodon"
     except: