about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-04-15 01:38:03 +0300
committerManeraKai <manerakai@protonmail.com>2022-04-15 01:38:03 +0300
commitd0c4a7b1e6f8a55a68980399a72bbad42540eb9c (patch)
treea5ceabd51b363a0a86b50804428da1f00ddb5490 /src
parentStill makin Pug structure. Finished adding LibreSpeed #170 (diff)
downloadlibredirect-d0c4a7b1e6f8a55a68980399a72bbad42540eb9c.zip
Fixed wikipedia mobile not redirecting #196. Improved Instances Fetching Script
Diffstat (limited to 'src')
-rw-r--r--src/assets/javascripts/helpers/wikipedia.js2
-rw-r--r--src/instances/data.json6
-rw-r--r--src/instances/get_instances.py7
3 files changed, 9 insertions, 6 deletions
diff --git a/src/assets/javascripts/helpers/wikipedia.js b/src/assets/javascripts/helpers/wikipedia.js
index 1973eb26..537cccd2 100644
--- a/src/assets/javascripts/helpers/wikipedia.js
+++ b/src/assets/javascripts/helpers/wikipedia.js
@@ -2,7 +2,7 @@ window.browser = window.browser || window.chrome;
 
 import commonHelper from './common.js'
 
-const targets = /^https?:\/{2}([a-z]{1,}\.|)wikipedia\.org/
+const targets = /^https?:\/{2}(([a-z]{1,}\.){0,})wikipedia\.org/
 
 let redirects = {
   "wikiless": {
diff --git a/src/instances/data.json b/src/instances/data.json
index c83679f7..d1212eaf 100644
--- a/src/instances/data.json
+++ b/src/instances/data.json
@@ -341,13 +341,13 @@
       "https://search.st8.at",
       "https://search.stinpriza.org",
       "https://search.trom.tf",
+      "https://search.vojkovic.xyz",
       "https://search.zdechov.net",
       "https://searx.bissisoft.com",
       "https://searx.divided-by-zero.eu",
       "https://searx.dresden.network",
       "https://searx.everdot.org",
       "https://searx.fossencdi.org",
-      "https://searx.gnous.eu",
       "https://searx.gnu.style",
       "https://searx.hardwired.link",
       "https://searx.josie.lol",
@@ -412,12 +412,12 @@
       "https://search.mdosch.de",
       "https://search.neet.works",
       "https://search.ononoki.org",
-      "https://search.vojkovic.xyz",
       "https://search.zzls.xyz",
       "https://searx.be",
       "https://searx.ebnar.xyz",
       "https://searx.esmailelbob.xyz",
       "https://searx.fmac.xyz",
+      "https://searx.gnous.eu",
       "https://searx.mha.fi",
       "https://searx.namejeff.xyz",
       "https://searx.prvcy.eu",
@@ -480,7 +480,6 @@
     "https://watch.riverside.rocks",
     "https://peer.galaxycrow.de",
     "https://sharetube.us",
-    "https://dalek.zone",
     "https://video.sadmin.io",
     "https://stream.jurnalfm.md",
     "https://video.asgardius.company",
@@ -554,7 +553,6 @@
     "https://docker.videos.lecygnenoir.info",
     "https://video.barcelo.cf",
     "https://videotube.duckdns.org",
-    "https://peertube.1001solutions.net",
     "https://tv.based.quest",
     "https://peertube.beardedtek.com",
     "https://casnocensure.site",
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py
index 1af243f5..8ecec164 100644
--- a/src/instances/get_instances.py
+++ b/src/instances/get_instances.py
@@ -6,6 +6,7 @@ from urllib.parse import urlparse
 from bs4 import BeautifulSoup
 import re
 from colorama import Fore, Back, Style
+from urllib.parse import urlparse
 
 mightyList = {}
 
@@ -278,7 +279,11 @@ print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Peertube')
 
 
 def isValid(url):  # This code is contributed by avanitrachhadiya2155
-    return re.search(r"([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z0-9]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}", url)
+    try:
+        result = urlparse(url)
+        return all([result.scheme, result.netloc, result.path])
+    except:
+        return False
 
 
 for k1, v1 in mightyList.items():