From d0c4a7b1e6f8a55a68980399a72bbad42540eb9c Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 15 Apr 2022 01:38:03 +0300 Subject: [PATCH] Fixed wikipedia mobile not redirecting #196. Improved Instances Fetching Script --- src/assets/javascripts/helpers/wikipedia.js | 2 +- src/instances/data.json | 6 ++---- src/instances/get_instances.py | 7 ++++++- 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():