Update domains used for scribe.rip replacements

The levelup.gitconnected.com site is a Medium site that can also be
replaced with scribe.rip whenever privacy respecting site alternatives
are enabled in the config.

Also modified how link descriptions are updated when that config is
enabled (before it was missing replacements on quite a few
descriptions).
main
Ben Busby 2021-10-23 23:23:37 -06:00
parent 05c492bf82
commit 8f70236403
No known key found for this signature in database
GPG Key ID: 339B7B7EB5333D14
2 changed files with 13 additions and 3 deletions

View File

@ -331,8 +331,15 @@ class Filter:
if len(link_desc) == 0: if len(link_desc) == 0:
return return
# Replace link destination # Replace link description
link_desc[0].replace_with(get_site_alt(link_desc[0])) 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: def view_image(self, soup) -> BeautifulSoup:
"""Replaces the soup with a new one that handles mobile results and """Replaces the soup with a new one that handles mobile results and

View File

@ -27,7 +27,10 @@ SITE_ALTS = {
'youtube.com': os.getenv('WHOOGLE_ALT_YT', 'invidious.snopyta.org'), 'youtube.com': os.getenv('WHOOGLE_ALT_YT', 'invidious.snopyta.org'),
'instagram.com': os.getenv('WHOOGLE_ALT_IG', 'bibliogram.art/u'), 'instagram.com': os.getenv('WHOOGLE_ALT_IG', 'bibliogram.art/u'),
'reddit.com': os.getenv('WHOOGLE_ALT_RD', 'libredd.it'), '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'))
} }