diff --git a/app/filter.py b/app/filter.py index 731b6aa..6b4e284 100644 --- a/app/filter.py +++ b/app/filter.py @@ -410,7 +410,7 @@ class Filter: # Replace link description link_desc = link_desc[0] for site, alt in SITE_ALTS.items(): - if site not in link_desc: + if site not in link_desc or not alt: continue new_desc = BeautifulSoup(features='html.parser').new_tag('div') new_desc.string = str(link_desc).replace(site, alt) diff --git a/app/utils/results.py b/app/utils/results.py index a7ce6f1..55e0079 100644 --- a/app/utils/results.py +++ b/app/utils/results.py @@ -128,7 +128,7 @@ def get_site_alt(link: str) -> str: hostname = urlparse.urlparse(link).hostname for site_key in SITE_ALTS.keys(): - if not hostname or site_key not in hostname: + if not hostname or site_key not in hostname or not SITE_ALTS[site_key]: continue link = link.replace(hostname, SITE_ALTS[site_key])