From ce3547224f1029b4aa8a83c4879b28b446fe2e0a Mon Sep 17 00:00:00 2001 From: Amm0ni4 Date: Fri, 19 Jan 2024 23:56:46 +0000 Subject: [PATCH] use include instead of match for some other complex regex --- 2_generate_includes.py | 2 +- Bypass_All_Shortlinks.user.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/2_generate_includes.py b/2_generate_includes.py index 75c6b34..01374b4 100644 --- a/2_generate_includes.py +++ b/2_generate_includes.py @@ -24,7 +24,7 @@ def regex_to_include_line(regex): #regex = regex.strip("/") #Use @include for more complex regex - if '|' in regex: + if any(char in regex for char in ['|', '(', ')', '*']): regex = '(' + regex + ')' include_line = "// @include /^(https?:\/\/)(.+)?" + regex + "(\/.*)/" include_line = include_line.replace( "\.*)(\/.*)/", "\.*)/" ) #clean excess in the regex diff --git a/Bypass_All_Shortlinks.user.js b/Bypass_All_Shortlinks.user.js index 597262e..592552f 100644 --- a/Bypass_All_Shortlinks.user.js +++ b/Bypass_All_Shortlinks.user.js @@ -116,7 +116,7 @@ // @match *://*.adbtc.top/* // @match *://*.youtube.com/* // @match *://*.upload.ee/* -// @match *://*.appdrive\.*/* +// @include /^(https?:\/\/)(.+)?(appdrive\.*)/ // @match *://*.dddrive.me/* // @match *://*.uppit.com/* // @match *://*.krakenfiles.com/* @@ -136,8 +136,8 @@ // @match *://*.files.fm/* // @match *://*.megaup.net/* // @match *://*.4fnet.org/* -// @match *://*.oxy\.*/* -// @match *://*.gdtot\.*/* +// @include /^(https?:\/\/)(.+)?(oxy\.*)/ +// @include /^(https?:\/\/)(.+)?(gdtot\.*)/ // @match *://*.mp4upload.com/* // @match *://*.drop.download/* // @match *://*.workupload.com/* @@ -335,7 +335,7 @@ // @include /^(https?:\/\/)(.+)?(writedroid.eu.org|modmania.eu.org|writedroid.in|mytop5.club)(\/.*)/ // @match *://*.computerpedia.in/* // @match *://*.finance.uploadsoon.com/* -// @match *://*.adclicker\.*/* +// @include /^(https?:\/\/)(.+)?(adclicker\.*)/ // @include /^(https?:\/\/)(.+)?(offers4crypto.xyz|ewall.biz)(\/.*)/ // @match *://*.dl.lk21static.xyz/* // @match *://*.easylink.gamingwithtr.com/*