From adf4d8f2cc3b26a32cb714ead5164b920c26f342 Mon Sep 17 00:00:00 2001 From: Imre Kristoffer Eilertsen Date: Thu, 14 May 2020 06:21:54 +0200 Subject: [PATCH] Add files via upload --- .../XYZPrepareFilters.py | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py b/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py index 96821e797..2c41f3a3f 100644 --- a/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py +++ b/NorwegianExperimentalList alternate versions/XYZPrepareFilters.py @@ -2285,6 +2285,66 @@ def prepare_ag(lines) -> str: line ) + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(1\)", + r"\1#?#*:has(> \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(2\)", + r"\1#?#*:has(> * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(3\)", + r"\1#?#*:has(> * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(4\)", + r"\1#?#*:has(> * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(5\)", + r"\1#?#*:has(> * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(6\)", + r"\1#?#*:has(> * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(7\)", + r"\1#?#*:has(> * > * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(8\)", + r"\1#?#*:has(> * > * > * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(9\)", + r"\1#?#*:has(> * > * > * > * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(10\)", + r"\1#?#*:has(> * > * > * > * > * > * > * > * > * > \2)", + line + ) + text += line + '\r\n' return text @@ -2394,6 +2454,66 @@ def prepare_abp(lines) -> str: line ) + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(1\)", + r"\1#?#*:has(> \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(2\)", + r"\1#?#*:has(> * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(3\)", + r"\1#?#*:has(> * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(4\)", + r"\1#?#*:has(> * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(5\)", + r"\1#?#*:has(> * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(6\)", + r"\1#?#*:has(> * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(7\)", + r"\1#?#*:has(> * > * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(8\)", + r"\1#?#*:has(> * > * > * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(9\)", + r"\1#?#*:has(> * > * > * > * > * > * > * > * > \2)", + line + ) + + line = re.sub( + r"([a-z*])#[?]?#(.*):(upward|nth-ancestor)\(10\)", + r"\1#?#*:has(> * > * > * > * > * > * > * > * > * > \2)", + line + ) + if is_supported_abp(line): text += line + '\r\n' @@ -2703,6 +2823,12 @@ def prepare_tpl(lines) -> str: line ) + line = re.sub( + r"^-d [a-z]{2,6}$", + "", + line + ) + if is_supported_tpl(line): text += line + '\r\n' @@ -2926,6 +3052,18 @@ def prepare_hosts(lines) -> str: line ) + line = re.sub( + r"^127\.0\.0\.1 [a-z]{2,6}$", + "", + line + ) + + line = re.sub( + r"^#$", + "", + line + ) + if is_supported_hosts(line): text += line + '\r\n' @@ -3006,6 +3144,24 @@ def prepare_domains(lines) -> str: line ) + line = re.sub( + r"^[a-z]{2,6}$", + "", + line + ) + + line = re.sub( + r"^/.*", + "", + line + ) + + line = re.sub( + r"^#$", + "", + line + ) + if is_supported_domains(line): text += line + '\r\n'