about summary refs log tree commit diff stats
path: root/src/instances
diff options
context:
space:
mode:
Diffstat (limited to 'src/instances')
-rw-r--r--src/instances/get_instances.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py
index 0d0e8c78..07adbceb 100644
--- a/src/instances/get_instances.py
+++ b/src/instances/get_instances.py
@@ -89,6 +89,19 @@ def is_authenticate(url):
         return False
     return False
 
+def is_offline(url):
+    try:
+        r = requests.get(url, timeout=5)
+        if r.status_code != 200:
+            print(url + ' is ' + Fore.RED + 'offline' + Style.RESET_ALL)
+            print("Status code")
+            print(r.status_code)
+            return True
+        else:
+            return False
+    except:
+        return False
+
 
 def invidious():
     r = requests.get('https://api.invidious.io/instances.json')
@@ -635,6 +648,7 @@ mightyList = filterLastSlash(mightyList)
 
 cloudflare = []
 authenticate = []
+offline = []
 for k1, v1 in mightyList.items():
     if type(mightyList[k1]) is dict:
         for k2, v2 in mightyList[k1].items():
@@ -647,12 +661,15 @@ for k1, v1 in mightyList.items():
                         cloudflare.append(instance)
                     if not instance.endswith('.onion') and not instance.endswith('.i2p') and not instance.endswith('.loki') and is_authenticate(instance):
                         authenticate.append(instance)
+                    if not instance.endswith('.onion') and not instance.endswith('.i2p') and not instance.endswith('.loki') and is_offline(instance):
+                        offline.append(instance)
 
 peertube()
 
 blacklist = {
     'cloudflare': cloudflare,
-    'authenticate': authenticate
+    'authenticate': authenticate,
+    'offline': offline
 }
 
 # Writing to file