Specify links that should trigger div removal from results

There are certain links (such as the age verification link mentioned in
issue #1083) that should trigger removal of the entire container div on
the results page, rather than just hiding the link itself.

This introduces a new `unsupported_g_divs` list that holds links that
will trigger a removal of the result div on the result page.

Fixes #1083
pull/1101/head
Ben Busby 6 months ago
parent 2a0b9a47b2
commit 9f68c843d6
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1

@ -29,9 +29,12 @@ unsupported_g_pages = [
'google.com/preferences',
'google.com/intl',
'advanced_search',
'tbm=shop'
'tbm=shop',
'ageverification.google.co.kr'
]
unsupported_g_divs = ['google.com/preferences?hl=', 'ageverification.google.co.kr']
def extract_q(q_str: str, href: str) -> str:
"""Extracts the 'q' element from a result link. This is typically
@ -554,7 +557,7 @@ class Filter:
link['href'] = link_netloc
parent = link.parent
if 'google.com/preferences?hl=' in link_netloc:
if any(divlink in link_netloc for divlink in unsupported_g_divs):
# Handle case where a search is performed in a different
# language than what is configured. This usually returns a
# div with the same classes as normal search results, but with

Loading…
Cancel
Save