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
parent
c2873190c9
commit
a7e937f7c6
|
@ -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
|
||||
|
|
|
@ -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'],
|
||||
|
|
Loading…
Reference in New Issue