diff --git a/ClearURLs for uBo/clear_urls_uboified.txt b/ClearURLs for uBo/clear_urls_uboified.txt index e3e3836cc..9b464d3ea 100644 --- a/ClearURLs for uBo/clear_urls_uboified.txt +++ b/ClearURLs for uBo/clear_urls_uboified.txt @@ -1,10 +1,10 @@ ! Title: ClearURLs for uBo - List extension ! Homepage: https://github.com/DandelionSprout/adfilt/discussions/163 -! Last updated: 07/11/2021 +! Last updated: 09/11/2021 ! Expires: 1 day ! Licence: https://github.com/DandelionSprout/adfilt/blob/master/LICENSE.md ! Note: This was based off of 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 -! IMPORTANT NOTE: Do not modify this file. This file is autogenerated and therefore any direct edit to it will be undone. Instead, modifications must be made to https://github.com/DandelionSprout/adfilt/blob/master/ClearURLs%20for%20uBo/compile.py or to the upstream ClearURLs rules +! IMPORTANT NOTE: Do not modify this file. This file is autogenerated and therefore any direct edit to it will be undone. Instead, modifications must be made to https://github.com/DandelionSprout/adfilt/blob/master/ClearURLs%20for%20uBo/compile.py or to the upstream ClearURLs rules. If you experience an issue, please report it to https://github.com/DandelionSprout/adfilt/discussions/163, and we (the Adfilt maintainers and community) will look into it and either add an exclusion or report it to the ClearURLs team $removeparam=/^p[fd]_rd_[a-z]*=/,domain=amazon.* $removeparam=qid,domain=amazon.* diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index 89639c879..aca9e4a1d 100644 --- a/ClearURLs for uBo/compile.py +++ b/ClearURLs for uBo/compile.py @@ -23,6 +23,7 @@ import json import sys +import hashlib from datetime import date from typing import IO @@ -35,7 +36,7 @@ HEAD = """\ ! Expires: 1 day ! Licence: https://github.com/DandelionSprout/adfilt/blob/master/LICENSE.md ! Note: This was based off of 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 -! IMPORTANT NOTE: Do not modify this file. This file is autogenerated and therefore any direct edit to it will be undone. Instead, modifications must be made to https://github.com/DandelionSprout/adfilt/blob/master/ClearURLs%20for%20uBo/compile.py or to the upstream ClearURLs rules +! IMPORTANT NOTE: Do not modify this file. This file is autogenerated and therefore any direct edit to it will be undone. Instead, modifications must be made to https://github.com/DandelionSprout/adfilt/blob/master/ClearURLs%20for%20uBo/compile.py or to the upstream ClearURLs rules. If you experience an issue, please report it to https://github.com/DandelionSprout/adfilt/discussions/163, and we (the Adfilt maintainers and community) will look into it and either add an exclusion or report it to the ClearURLs team """ KNOWN_BAD_FILTERS = [ @@ -135,9 +136,28 @@ def getrules() -> str: RULES = "https://raw.githubusercontent.com/ClearURLs/Rules/master/data.min.json" return requests.get(RULES).text +def haschanged() -> bool: + c = False + try: + hashes = json.loads(open("hash.txt").read()) + except: + hashes = [] + toph = hashlib.sha256(HEAD.encode()).hexdigest() + if toph not in hashes: + c = True + ruleshash = hashlib.sha256(getrules().encode()).hexdigest() + if ruleshash not in hashes: + c = True + with open("hash.txt","w") as rulesf: + rulesf.write(json.dumps([toph,ruleshash])) + rulesf.close() + return c def main() -> int: data_min_json = json.loads(getrules()) + if haschanged() == False: + print("No change in rules. Exiting...") + sys.exit() filterlist = open("clear_urls_uboified.txt", "w") filterlist.write(HEAD.format(date=date.today().strftime("%d/%m/%Y"))) diff --git a/ClearURLs for uBo/hash.txt b/ClearURLs for uBo/hash.txt new file mode 100644 index 000000000..42d6e0997 --- /dev/null +++ b/ClearURLs for uBo/hash.txt @@ -0,0 +1 @@ +["ddfdb898086c2c8451f7ac7d596f0468f0efc5863c4d1a3e3496829ef15a62bf", "a02393e204e697dc1a40b7215ab6eaec85c5c217b381c89d6f46e832cd3d2398"] \ No newline at end of file