From 55e88ad86868423ba4ca4dafb7b657d58b069bdd Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Mon, 8 Nov 2021 07:41:10 -0500 Subject: [PATCH 1/8] Update compile.py --- ClearURLs for uBo/compile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index 89639c879..707089525 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 @@ -135,6 +136,12 @@ def getrules() -> str: RULES = "https://raw.githubusercontent.com/ClearURLs/Rules/master/data.min.json" return requests.get(RULES).text +def haschanged() -> bool: + try: + hashes = json.loads(open("hash.txt").read() + except: + hashes = [] + toph = hashlib.sha256("") def main() -> int: data_min_json = json.loads(getrules()) From f091c82625e17b6a2fa50e558ba6d0fa3afb1ce8 Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Tue, 9 Nov 2021 06:25:25 -0500 Subject: [PATCH 2/8] Update compile.py --- ClearURLs for uBo/compile.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index 707089525..0675d39e9 100644 --- a/ClearURLs for uBo/compile.py +++ b/ClearURLs for uBo/compile.py @@ -137,14 +137,27 @@ def getrules() -> str: return requests.get(RULES).text def haschanged() -> bool: + c = False try: hashes = json.loads(open("hash.txt").read() except: hashes = [] - toph = hashlib.sha256("") + toph = hashlib.sha256(HEAD.encode()).hexdigest() + if toph not in hashes: + c = True + ruleshash = hashlib.sha256(json.loads(getrules())) + if ruleshash not in hashes: + c = True + with open("hash.txt","w") as f: + f.write(json.dumps([toph,ruleshash])) + f.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"))) From 135f75117993a35755332eb33e83778e2ea0ffe8 Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Tue, 9 Nov 2021 06:29:46 -0500 Subject: [PATCH 3/8] Typo --- ClearURLs for uBo/compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index 0675d39e9..8f3ce051c 100644 --- a/ClearURLs for uBo/compile.py +++ b/ClearURLs for uBo/compile.py @@ -139,7 +139,7 @@ def getrules() -> str: def haschanged() -> bool: c = False try: - hashes = json.loads(open("hash.txt").read() + hashes = json.loads(open("hash.txt").read()) except: hashes = [] toph = hashlib.sha256(HEAD.encode()).hexdigest() From 0cff47d14f10900c4c695824dcb24c1343451800 Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Tue, 9 Nov 2021 06:31:54 -0500 Subject: [PATCH 4/8] Type errors --- ClearURLs for uBo/compile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index 8f3ce051c..cca1beda3 100644 --- a/ClearURLs for uBo/compile.py +++ b/ClearURLs for uBo/compile.py @@ -145,12 +145,12 @@ def haschanged() -> bool: toph = hashlib.sha256(HEAD.encode()).hexdigest() if toph not in hashes: c = True - ruleshash = hashlib.sha256(json.loads(getrules())) + ruleshash = hashlib.sha256(json.loads(getrules()).encode()).hexdigest() if ruleshash not in hashes: c = True - with open("hash.txt","w") as f: - f.write(json.dumps([toph,ruleshash])) - f.close() + with open("hash.txt","w") as rulesf: + rulesf.write(json.dumps([toph,ruleshash])) + rulesf.close() return c def main() -> int: From d83f086e1868c98f8440793e11061728078bfe35 Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Tue, 9 Nov 2021 06:33:45 -0500 Subject: [PATCH 5/8] JSON --- ClearURLs for uBo/compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index cca1beda3..a46e6d6f2 100644 --- a/ClearURLs for uBo/compile.py +++ b/ClearURLs for uBo/compile.py @@ -145,7 +145,7 @@ def haschanged() -> bool: toph = hashlib.sha256(HEAD.encode()).hexdigest() if toph not in hashes: c = True - ruleshash = hashlib.sha256(json.loads(getrules()).encode()).hexdigest() + ruleshash = hashlib.sha256(getrules().encode()).hexdigest() if ruleshash not in hashes: c = True with open("hash.txt","w") as rulesf: From 4e7dde603b8545dd6b7c9e6b5d5d6657d096ba58 Mon Sep 17 00:00:00 2001 From: Update bot Date: Tue, 9 Nov 2021 11:34:04 +0000 Subject: [PATCH 6/8] Update the ClearURLs uBo list --- ClearURLs for uBo/clear_urls_uboified.txt | 2 +- ClearURLs for uBo/hash.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 ClearURLs for uBo/hash.txt diff --git a/ClearURLs for uBo/clear_urls_uboified.txt b/ClearURLs for uBo/clear_urls_uboified.txt index e3e3836cc..2046084b4 100644 --- a/ClearURLs for uBo/clear_urls_uboified.txt +++ b/ClearURLs for uBo/clear_urls_uboified.txt @@ -1,6 +1,6 @@ ! 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 diff --git a/ClearURLs for uBo/hash.txt b/ClearURLs for uBo/hash.txt new file mode 100644 index 000000000..c6673e187 --- /dev/null +++ b/ClearURLs for uBo/hash.txt @@ -0,0 +1 @@ +["ac7f4ac36f1897049085718bf7c8e5ab3dabc5a793198a00c50244aca7ec7bcb", "a02393e204e697dc1a40b7215ab6eaec85c5c217b381c89d6f46e832cd3d2398"] \ No newline at end of file From 5d88626e4d87e13c3e46a3bb3f6ed7ab0d5f4000 Mon Sep 17 00:00:00 2001 From: iam-py-test <84232764+iam-py-test@users.noreply.github.com> Date: Tue, 9 Nov 2021 06:45:58 -0500 Subject: [PATCH 7/8] Testing what happens --- ClearURLs for uBo/compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClearURLs for uBo/compile.py b/ClearURLs for uBo/compile.py index a46e6d6f2..aca9e4a1d 100644 --- a/ClearURLs for uBo/compile.py +++ b/ClearURLs for uBo/compile.py @@ -36,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 = [ From 29df20dc6bbb11fa86cfd9302bbfcf8ea3438a43 Mon Sep 17 00:00:00 2001 From: Update bot Date: Tue, 9 Nov 2021 11:46:15 +0000 Subject: [PATCH 8/8] Update the ClearURLs uBo list --- ClearURLs for uBo/clear_urls_uboified.txt | 2 +- ClearURLs for uBo/hash.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ClearURLs for uBo/clear_urls_uboified.txt b/ClearURLs for uBo/clear_urls_uboified.txt index 2046084b4..9b464d3ea 100644 --- a/ClearURLs for uBo/clear_urls_uboified.txt +++ b/ClearURLs for uBo/clear_urls_uboified.txt @@ -4,7 +4,7 @@ ! 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/hash.txt b/ClearURLs for uBo/hash.txt index c6673e187..42d6e0997 100644 --- a/ClearURLs for uBo/hash.txt +++ b/ClearURLs for uBo/hash.txt @@ -1 +1 @@ -["ac7f4ac36f1897049085718bf7c8e5ab3dabc5a793198a00c50244aca7ec7bcb", "a02393e204e697dc1a40b7215ab6eaec85c5c217b381c89d6f46e832cd3d2398"] \ No newline at end of file +["ddfdb898086c2c8451f7ac7d596f0468f0efc5863c4d1a3e3496829ef15a62bf", "a02393e204e697dc1a40b7215ab6eaec85c5c217b381c89d6f46e832cd3d2398"] \ No newline at end of file