diff --git a/scripts/compile.py b/scripts/compile.py index 1a2511caf..44a912051 100644 --- a/scripts/compile.py +++ b/scripts/compile.py @@ -23,9 +23,21 @@ import json import sys +from datetime import date + +import requests + +HEAD = """\ +! Title: ClearURLs for uBo - List extension +! Homepage: https://github.com/DandelionSprout/adfilt/discussions/163 +! Last updated: {date} +! Note: This was forked from https://gist.github.com/rusty-snake/5cd83a87d680ecbd03e79a1a06758207, which is based off of https://github.com/ClearURLs/Rules. The maintainers of Adfilt (DandelionSprout and iam-py-test, and contributors) have made some modifications as to keep it up-to-date with the source and to fix issues + +""" endrules = None + def normalize_url_pattern(url_pattern: str) -> str: # No need for protocol and subdomain url_pattern = url_pattern.replace(r"^https?:\/\/(?:[a-z0-9-]+\.)*?", "", 1) @@ -102,16 +114,16 @@ def print_rules( else: endrules.write(plain_format.format(rule, url_pattern) + "\n") -def getrules(): - import requests - return requests.get("https://raw.githubusercontent.com/ClearURLs/Rules/master/data.min.json").text +def getrules() -> str: + RULES = "https://raw.githubusercontent.com/ClearURLs/Rules/master/data.min.json" + return requests.get(RULES).text + + def main() -> int: global endrules data_min_json = json.loads(getrules()) - endrules = open("uBO list extensions/clear_urls_uboified.txt","w") - endrules.write("! Title: ClearURLs for uBlock Origin\n") - endrules.write("! Homepage: https://github.com/DandelionSprout/adfilt\n") - endrules.write("! Expires: 1 day\n\n") + endrules = open("uBO list extensions/clear_urls_uboified.txt", "w") + endrules.write(HEAD.format(date=date.today().strftime("%d/%m/%Y"))) # TODO: referralMarketing providers = { diff --git a/uBO list extensions/clear_urls_uboified.txt b/uBO list extensions/clear_urls_uboified.txt index b164dd1bd..1e5d4131c 100644 --- a/uBO list extensions/clear_urls_uboified.txt +++ b/uBO list extensions/clear_urls_uboified.txt @@ -1,6 +1,7 @@ -! Title: ClearURLs for uBlock Origin -! Homepage: https://github.com/DandelionSprout/adfilt -! Expires: 1 day +! Title: ClearURLs for uBo - List extension +! Homepage: https://github.com/DandelionSprout/adfilt/discussions/163 +! Last updated: 07/11/2021 +! Note: This was forked from https://gist.github.com/rusty-snake/5cd83a87d680ecbd03e79a1a06758207, which is based off of https://github.com/ClearURLs/Rules. The maintainers of Adfilt (DandelionSprout and iam-py-test, and contributors) have made some modifications as to keep it up-to-date with the source and to fix issues $removeparam=/^p[fd]_rd_[a-z]*=/,domain=amazon.* $removeparam=qid,domain=amazon.*