From 284d858d4378ae5f1b1638314ef59bb5b4348716 Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Sat, 6 Nov 2021 16:18:12 -0400 Subject: [PATCH] Write the rules to a file --- scripts/compile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/compile.py b/scripts/compile.py index 032829fba..0ea9b0b53 100644 --- a/scripts/compile.py +++ b/scripts/compile.py @@ -24,6 +24,7 @@ import json import sys +endrules = None def normalize_url_pattern(url_pattern: str) -> str: # No need for protocol and subdomain @@ -105,8 +106,9 @@ def getrules(): import requests return requests.get("https://raw.githubusercontent.com/ClearURLs/Rules/master/data.min.json").text def main() -> int: - + global endrules data_min_json = json.loads(getrules()) + endrules = open("uBO list extensions/clear_urls_uboified.txt","w") # TODO: referralMarketing providers = { @@ -147,11 +149,11 @@ def main() -> int: for exception in exceptions: kind, exception = normalize_exception(exception.replace("\\\\", "\\")) if kind == "regex": - print("@@/{0}/$removeparam".format(exception)) + endrules.write("@@/{0}/$removeparam".format(exception)) elif kind == "path": - print("@@{0}$removeparam".format(exception)) + endrules.write("@@{0}$removeparam".format(exception)) elif kind == "domain": - print("@@$removeparam,domain={0}".format(exception)) + endrules.write("@@$removeparam,domain={0}".format(exception)) else: raise ValueError