From a7e937f7c6272b467af19e8f9ada80886bfe6720 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 11 Oct 2023 15:58:52 -0600 Subject: [PATCH] Skip scrollers when applying site icons to results Scroller results (like the "latest from ___" or "top stories" results) shouldn't have a site icon associated with them. This extracts the class that those types of results have and skips over the process of inserting an icon. --- app/filter.py | 7 +++++-- app/models/g_classes.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/filter.py b/app/filter.py index e7afaa4..db28b63 100644 --- a/app/filter.py +++ b/app/filter.py @@ -251,9 +251,9 @@ class Filter: # favicon attached, and that the div is a result div while parent: p_cls = parent.attrs.get('class') or [] - if 'has-favicon' in p_cls: + if 'has-favicon' in p_cls or GClasses.scroller_class in p_cls: return - elif f'{GClasses.result_class_a}' not in p_cls: + elif GClasses.result_class_a not in p_cls: parent = parent.parent else: is_result_div = True @@ -280,6 +280,9 @@ class Filter: parent['class'] = p_cls parent = parent.parent + if GClasses.result_class_a in p_cls: + break + def remove_site_blocks(self, soup) -> None: if not self.config.block or not soup.body: return diff --git a/app/models/g_classes.py b/app/models/g_classes.py index 0c32f41..414e236 100644 --- a/app/models/g_classes.py +++ b/app/models/g_classes.py @@ -14,6 +14,7 @@ class GClasses: footer = 'TuS8Ad' result_class_a = 'ZINbbc' result_class_b = 'luh4td' + scroller_class = 'idg8be' result_classes = { result_class_a: ['Gx5Zad'],