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
This commit is contained in:
Amm0ni4 2024-02-25 14:10:27 +01:00
parent a2992f2ed1
commit 56662a8946
4 changed files with 39 additions and 13 deletions

View file

@ -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:

View file

@ -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=/

View file

@ -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)) {

View file

@ -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)) {