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.
main
Ben Busby 2023-10-11 15:58:52 -06:00
parent c2873190c9
commit a7e937f7c6
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1
2 changed files with 6 additions and 2 deletions

View File

@ -251,9 +251,9 @@ class Filter:
# favicon attached, and that the div is a result div # favicon attached, and that the div is a result div
while parent: while parent:
p_cls = parent.attrs.get('class') or [] 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 return
elif f'{GClasses.result_class_a}' not in p_cls: elif GClasses.result_class_a not in p_cls:
parent = parent.parent parent = parent.parent
else: else:
is_result_div = True is_result_div = True
@ -280,6 +280,9 @@ class Filter:
parent['class'] = p_cls parent['class'] = p_cls
parent = parent.parent parent = parent.parent
if GClasses.result_class_a in p_cls:
break
def remove_site_blocks(self, soup) -> None: def remove_site_blocks(self, soup) -> None:
if not self.config.block or not soup.body: if not self.config.block or not soup.body:
return return

View File

@ -14,6 +14,7 @@ class GClasses:
footer = 'TuS8Ad' footer = 'TuS8Ad'
result_class_a = 'ZINbbc' result_class_a = 'ZINbbc'
result_class_b = 'luh4td' result_class_b = 'luh4td'
scroller_class = 'idg8be'
result_classes = { result_classes = {
result_class_a: ['Gx5Zad'], result_class_a: ['Gx5Zad'],