From 66391fb7c0fd88fef8d60b144c3de411c7acce68 Mon Sep 17 00:00:00 2001 From: Amm0ni4 Date: Mon, 29 Jan 2024 18:32:19 +0100 Subject: [PATCH] generate include and match rules separatedly this can be useful for copy-pasting these rules into the script settings in ViolentMonkey --- .gitignore | 2 ++ 2_generate_includes.py | 69 ++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 2541b99..5988593 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ untouched_Bypass_All_Shortlinks.user.js includes.txt +match_rules.txt +include_rules.txt diff --git a/2_generate_includes.py b/2_generate_includes.py index aef22b9..9bee66e 100644 --- a/2_generate_includes.py +++ b/2_generate_includes.py @@ -4,10 +4,9 @@ def extract_regex_from_js(js_code): pattern1 = r'(?= 5] - + # remove domains with blocked words blocked_words_for_includes = [ "google", @@ -79,7 +74,7 @@ def main(): ] regex_strings = [s for s in regex_strings if not any(word in s for word in blocked_words_for_includes)] - compile_and_print(regex_strings) + generate_include_lines(regex_strings) except FileNotFoundError: print(f"Error: File '{file_path}' not found.") except Exception as e: