From 56662a894625216a86261d324cf53efac514332c Mon Sep 17 00:00:00 2001 From: Amm0ni4 Date: Sun, 25 Feb 2024 14:10:27 +0100 Subject: [PATCH] added a bit more automation to the ad-maven 3rd party bypass also improved the python script for adding stuff from the extra bypasses so now it also passes the @grant values --- 4_add_extra_bypasses.py | 32 ++++++++++++++++++++++++-------- Bypass_All_Shortlinks.meta.js | 1 + Bypass_All_Shortlinks.user.js | 7 ++++++- extra_bypasses/ad-maven.user.js | 12 ++++++++---- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/4_add_extra_bypasses.py b/4_add_extra_bypasses.py index 7d2e47d..b295647 100644 --- a/4_add_extra_bypasses.py +++ b/4_add_extra_bypasses.py @@ -25,8 +25,15 @@ def generate_metadata_file(input_file, output_file): # Function to read and modify .js files def process_js_files(folder_path, target_file): + + # Read the content of the target file + with open(target_file, 'r', encoding='utf-8') as f: + target_file_lines = f.readlines() + # Initialize lists to store lines to be added + grant_lines = [] match_lines = [] + include_lines = [] require_lines = [] after_user_script_lines = [] @@ -36,12 +43,18 @@ def process_js_files(folder_path, target_file): with open(os.path.join(folder_path, filename), 'r', encoding='utf-8') as f: lines = f.readlines() - # Find lines with "@match" or "@include" or "@require" + # Find lines with "@match" or "@include" or "@require" or "@grant". Add them if they are not already in the target file. for line in lines: - if "@match" in line or "@include" in line: - match_lines.append(line) - if "@require" in line: - require_lines.append(line) + if "@match" in line or "@include" in line or "@require" in line or "@grant" in line: + if line not in target_file_lines: + if line.startswith("// @grant"): + grant_lines.append(line) + elif line.startswith("// @match"): + match_lines.append(line) + elif line.startswith("// @include"): + include_lines.append(line) + elif line.startswith("// @require"): + require_lines.append(line) # Find lines after "// ==/UserScript==" after_user_script = False @@ -57,17 +70,20 @@ def process_js_files(folder_path, target_file): exclude_index = next((i for i, line in enumerate(content) if "@exclude" in line), None) if exclude_index is not None: # Add match_lines and require_lines before the first @exclude line - content = content[:exclude_index] + match_lines + require_lines + content[exclude_index:] + content = content[:exclude_index] + grant_lines + match_lines + include_lines + require_lines + content[exclude_index:] # Add lines after "// ==/UserScript==" content.extend(after_user_script_lines) f.seek(0) f.writelines(content) - # Clean match lines and add them to supported_sites.txt + # Clean match and include lines and add them to supported_sites.txt cleaned_lines = [] for line in match_lines: - cleaned_line = line.strip().replace("// @match", "").replace("// @include", "").strip() + cleaned_line = line.strip().replace("// @match", "").strip() + cleaned_lines.append(cleaned_line) + for line in include_lines: + cleaned_line = line.strip().replace("// @include", "").strip() cleaned_lines.append(cleaned_line) with open("supported_sites.txt", 'a', encoding='utf-8') as f: for line in cleaned_lines: diff --git a/Bypass_All_Shortlinks.meta.js b/Bypass_All_Shortlinks.meta.js index 25db964..c1941e2 100644 --- a/Bypass_All_Shortlinks.meta.js +++ b/Bypass_All_Shortlinks.meta.js @@ -646,6 +646,7 @@ // @match *://*.playstore.pw/* // @match *://*.sigmalinks.in/* // @match *://*.r1.foxylinks.site/* +// @grant GM_deleteValue // @include /(free-content.pro|((ebaticalfel|downbadleaks|megadropsz|megadumpz|stownrusis|iedprivatedqu).com))\/s\?/ // @include /adbypass.eu/ // @include /(bypass.city|adbypass.org)\/bypass\?bypass=/ diff --git a/Bypass_All_Shortlinks.user.js b/Bypass_All_Shortlinks.user.js index 0eee64f..c492f2f 100644 --- a/Bypass_All_Shortlinks.user.js +++ b/Bypass_All_Shortlinks.user.js @@ -646,6 +646,7 @@ // @match *://*.playstore.pw/* // @match *://*.sigmalinks.in/* // @match *://*.r1.foxylinks.site/* +// @grant GM_deleteValue // @include /(free-content.pro|((ebaticalfel|downbadleaks|megadropsz|megadumpz|stownrusis|iedprivatedqu).com))\/s\?/ // @include /adbypass.eu/ // @include /(bypass.city|adbypass.org)\/bypass\?bypass=/ @@ -1738,7 +1739,7 @@ }})(); -// ----- Bypass ad-maven link shorteners ----- +// ----- Bypass ad-maven with adbypass.eu ----- (function() { 'use strict'; var url = window.location.href; @@ -1752,6 +1753,10 @@ if (savedShortlink && inputField) { inputField.value = savedShortlink; GM_deleteValue('savedShortlink'); + setTimeout(function() { + document.querySelector('#bttn').click(); + alert('Bypass started. Wait a few seconds.') + }, 500);// Wait 0.5 to press the button } }); } else if (/adbypass.eu\/unblock/.test(url)) { diff --git a/extra_bypasses/ad-maven.user.js b/extra_bypasses/ad-maven.user.js index eea72cb..e54778c 100644 --- a/extra_bypasses/ad-maven.user.js +++ b/extra_bypasses/ad-maven.user.js @@ -3,13 +3,13 @@ // @description These bypasses are always merged into Bypass_All_Shortlinks.user.js // @include /(free-content.pro|((ebaticalfel|downbadleaks|megadropsz|megadumpz|stownrusis|iedprivatedqu).com))\/s\?/ // @include /adbypass.eu/ -// @grant GM_setValue -// @grant GM_getValue -// @grant GM_deleteValue +// @grant GM_setValue +// @grant GM_getValue +// @grant GM_deleteValue // @run-at document-start // ==/UserScript== -// ----- Bypass ad-maven link shorteners ----- +// ----- Bypass ad-maven with adbypass.eu ----- (function() { 'use strict'; var url = window.location.href; @@ -23,6 +23,10 @@ if (savedShortlink && inputField) { inputField.value = savedShortlink; GM_deleteValue('savedShortlink'); + setTimeout(function() { + document.querySelector('#bttn').click(); + alert('Bypass started. Wait a few seconds.') + }, 500);// Wait 0.5 to press the button } }); } else if (/adbypass.eu\/unblock/.test(url)) {