Only remove G links in footer

Links that were directed at G domains were previously removed
universally, when really they only needed to be removed from the footer
to reduce possible confusion caused by mixed Whoogle and G links.

Fixes #656
main
Ben Busby 2022-03-01 12:48:33 -07:00
parent 69f845a047
commit f7e3650728
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1
2 changed files with 7 additions and 1 deletions

View File

@ -349,7 +349,12 @@ class Filter:
if any(url in link['href'] for url in unsupported_g_pages): if any(url in link['href'] for url in unsupported_g_pages):
# FIXME: The "Shopping" tab requires further filtering (see #136) # FIXME: The "Shopping" tab requires further filtering (see #136)
# Temporarily removing all links to that tab for now. # Temporarily removing all links to that tab for now.
link.decompose() parent = link.parent
while parent:
p_cls = parent.attrs.get('class') or []
if parent.name == 'footer' or f'{GClasses.footer}' in p_cls:
link.decompose()
parent = parent.parent
return return
# Replace href with only the intended destination (no "utm" type tags) # Replace href with only the intended destination (no "utm" type tags)

View File

@ -11,6 +11,7 @@ class GClasses(Enum):
""" """
main_tbm_tab = 'KP7LCb' main_tbm_tab = 'KP7LCb'
images_tbm_tab = 'n692Zd' images_tbm_tab = 'n692Zd'
footer = 'TuS8Ad'
def __str__(self): def __str__(self):
return self.value return self.value