about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBobIsMyManager <bimmgitsignature.nly8m@simplelogin.co>2022-07-18 10:28:03 +0100
committerBobIsMyManager <bimmgitsignature.nly8m@simplelogin.co>2022-07-18 18:50:04 +0100
commit3565707962170a736195eb810940569cc2aa1891 (patch)
treea8b3f1d2a371edd8e4a3258d81d8ac87bf17c4f2
parentdata and blacklist only handled by ci (diff)
downloadlibredirect-3565707962170a736195eb810940569cc2aa1891.zip
No more trailing slashes
-rw-r--r--src/instances/get_instances.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py
index 35144070..e211a596 100644
--- a/src/instances/get_instances.py
+++ b/src/instances/get_instances.py
@@ -14,13 +14,17 @@ mightyList = {}
 
 
 def filterLastSlash(urlList):
-    tmp = []
-    for i in urlList:
-        if i.endswith('/'):
-            tmp.append(i[:-1])
-            print(Fore.YELLOW + "Fixed " + Style.RESET_ALL + i)
-        else:
-            tmp.append(i)
+    tmp = {}
+    for x in urlList:
+        tmp[x] = {}
+        for y in urlList[x]:
+            tmp[x][y] = []
+            for z in urlList[x][y]:
+                if z.endswith('/'):
+                    tmp[x][y].append(z[:-1])
+                    print(Fore.YELLOW + "Fixed " + Style.RESET_ALL + z)
+                else:
+                    tmp[x][y].append(z)
     return tmp
 
 
@@ -177,7 +181,6 @@ def libreddit():
     tmp = re.findall(
         r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text)
 
-    tmp = filterLastSlash(tmp)
 
     for item in tmp:
         if item.endswith('.onion'):
@@ -249,7 +252,6 @@ def quetre():
     tmp = re.findall(
         r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text)
 
-    tmp = filterLastSlash(tmp)
 
     for item in tmp:
         if item.endswith('.onion'):
@@ -270,7 +272,6 @@ def libremdb():
     tmp = re.findall(
         r"\| ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)*\|*[A-Z]{0,}.*\|.*\|", r.text)
 
-    tmp = filterLastSlash(tmp)
 
     for item in tmp:
         if item.strip() == "":
@@ -459,6 +460,7 @@ searx_searxng()
 whoogle()
 librex()
 rimgo()
+mightyList = filterLastSlash(mightyList)
 
 cloudflare = []
 authenticate = []