From 8f6ca9661be673a96f5d1b7b7da39f2b2caa13f3 Mon Sep 17 00:00:00 2001 From: Imre Kristoffer Eilertsen Date: Fri, 3 Apr 2020 13:28:41 +0200 Subject: [PATCH] Add files via upload --- .../NordicFiltersABP.txt | 1 + .../XYZPrepareFilters.py | 98 ++++--------------- 2 files changed, 20 insertions(+), 79 deletions(-) diff --git a/NorwegianExperimentalList alternate versions/NordicFiltersABP.txt b/NorwegianExperimentalList alternate versions/NordicFiltersABP.txt index 35aed9a25..0844a547f 100644 --- a/NorwegianExperimentalList alternate versions/NordicFiltersABP.txt +++ b/NorwegianExperimentalList alternate versions/NordicFiltersABP.txt @@ -658,6 +658,7 @@ tipsbladet.dk##.col--lg-fixed-width-sidebar.col--xs-12 bilnorge.no##td[colspan="7"][style] yrkesbil.no###nettboard_art1 yrkesbil.no#?#td:-abp-has(:scope > noscript) +yrkesbil.no#?#*:-abp-has(:scope > .forside_adholder) yrkesbil.no#?#td:-abp-has(img[src="gifs/1pix.gif"]) yrkesbil.no##td:empty ||yrkesbil.no/gifs/*emty.gif^ diff --git a/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py b/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py index 6149dcf1e..bce36926a 100644 --- a/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py +++ b/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py @@ -45,7 +45,7 @@ def prepare_ag(lines) -> str: ) line = re.sub( - r"! Version: [0-9][0-9][0-9][0-9].*", + r"! Version: [0-9]{4}.*", "", line ) @@ -165,13 +165,13 @@ def prepare_ag(lines) -> str: ) line = re.sub( - r"^\|\|([1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9])\^\$.*", + r"^\|\|(([1-2]?[0-9]?[0-9]\.?){4})\^\$.*", r"\1$network", line ) line = re.sub( - r"^\|\|([1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9])\^", + r"^\|\|(([1-2]?[0-9]?[0-9]\.?){4})\^", r"\1$network", line ) @@ -469,121 +469,61 @@ def prepare_abp(lines) -> str: ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(1)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(1\)", r"\1#?#*:-abp-has(:scope > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(2)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(2\)", r"\1#?#*:-abp-has(:scope > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(3)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(3\)", r"\1#?#*:-abp-has(:scope > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(4)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(4\)", r"\1#?#*:-abp-has(:scope > * > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(5)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(5\)", r"\1#?#*:-abp-has(:scope > * > * > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(6)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(6\)", r"\1#?#*:-abp-has(:scope > * > * > * > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(7)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(7\)", r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(8)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(8\)", r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(9)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(9\)", r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > * > * > \2)", line ) line = re.sub( - r"([a-z*])#[?]?#(.*):nth-ancestor(10)", - r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(1)", - r"\1#?#*:-abp-has(:scope > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(2)", - r"\1#?#*:-abp-has(:scope > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(3)", - r"\1#?#*:-abp-has(:scope > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(4)", - r"\1#?#*:-abp-has(:scope > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(5)", - r"\1#?#*:-abp-has(:scope > * > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(6)", - r"\1#?#*:-abp-has(:scope > * > * > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(7)", - r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(8)", - r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(9)", - r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > * > * > \2)", - line - ) - - line = re.sub( - r"([a-z*])#[?]?#(.*):upward(10)", + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(10\)", r"\1#?#*:-abp-has(:scope > * > * > * > * > * > * > * > * > * > \2)", line ) @@ -1637,7 +1577,7 @@ def prepare_agh(lines) -> str: ) line = re.sub( - r"^\|\|([1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9])\^", + r"^\|\|(([1-2]?[0-9]?[0-9]\.?){4})\^", r"\1", line ) @@ -1690,7 +1630,7 @@ def prepare_shadowsocks(lines) -> str: ) line = re.sub( - r"^([^DU].*?\.[a-z][a-z][a-z]?[a-z]?[a-z]?[a-z]?)$", + r"^([^DU].*?\.[a-z]{2,6})$", r"DOMAIN-SUFFIX,\1", line ) @@ -1726,7 +1666,7 @@ def prepare_shadowsocks(lines) -> str: ) line = re.sub( - r"^([0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]\.[0-9][0-9]?[0-9])$", + r"^(([1-2]?[0-9]?[0-9]\.?){4})$", r"IP-CIDR,\1/32,REJECT,no-resolve", line ) @@ -2034,7 +1974,7 @@ def prepare_ag(lines) -> str: ) line = re.sub( - r"! Version: [0-9][0-9][0-9][0-9].*", + r"! Version: [0-9]{4}.*", "", line ) @@ -2082,7 +2022,7 @@ def prepare_ag(lines) -> str: ) line = re.sub( - r"^\|\|([1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9])\^\$.*", + r"^\|\|(([1-2]?[0-9]?[0-9]\.?){4})\^\$.*", r"\1$network", line ) @@ -2930,7 +2870,7 @@ def prepare_agh(lines) -> str: ) line = re.sub( - r"\|\|([1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]\.[1-2]?[0-9]?[0-9]).*", + r"\|\|(([1-2]?[0-9]?[0-9]\.?){4}).*", r"\1", line )