diff --git a/app/filter.py b/app/filter.py index 97d52db..8f241e5 100644 --- a/app/filter.py +++ b/app/filter.py @@ -331,8 +331,15 @@ class Filter: if len(link_desc) == 0: return - # Replace link destination - link_desc[0].replace_with(get_site_alt(link_desc[0])) + # Replace link description + link_desc = link_desc[0] + for site, alt in SITE_ALTS.items(): + if site not in link_desc: + continue + new_desc = BeautifulSoup(features='html.parser').new_tag('div') + new_desc.string = str(link_desc).replace(site, alt) + link_desc.replace_with(new_desc) + break def view_image(self, soup) -> BeautifulSoup: """Replaces the soup with a new one that handles mobile results and diff --git a/app/utils/results.py b/app/utils/results.py index a199427..8141074 100644 --- a/app/utils/results.py +++ b/app/utils/results.py @@ -27,7 +27,10 @@ SITE_ALTS = { 'youtube.com': os.getenv('WHOOGLE_ALT_YT', 'invidious.snopyta.org'), 'instagram.com': os.getenv('WHOOGLE_ALT_IG', 'bibliogram.art/u'), 'reddit.com': os.getenv('WHOOGLE_ALT_RD', 'libredd.it'), - 'medium.com': os.getenv('WHOOGLE_ALT_MD', 'scribe.rip'), + **dict.fromkeys([ + 'medium.com', + 'levelup.gitconnected.com' + ], os.getenv('WHOOGLE_ALT_MD', 'scribe.rip')) }