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
pull/691/head
Ben Busby 2 years ago
parent 69f845a047
commit f7e3650728
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1

@ -349,7 +349,12 @@ class Filter:
if any(url in link['href'] for url in unsupported_g_pages):
# FIXME: The "Shopping" tab requires further filtering (see #136)
# 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
# Replace href with only the intended destination (no "utm" type tags)

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

Loading…
Cancel
Save