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
このコミットが含まれているのは:
Ben Busby 2022-03-01 12:48:33 -07:00
コミット f7e3650728
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: B9B7231E01D924A1
2個のファイルの変更7行の追加1行の削除

ファイルの表示

@ -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