From 505249bcf431b46088c53b187946dc53bf41433e Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 21 Jun 2021 16:52:55 +0100 Subject: [PATCH] handle local stockinformer urls --- app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 195d5d0..d46cd7f 100644 --- a/app.py +++ b/app.py @@ -50,7 +50,13 @@ def get_stockinformer_url(url: str) -> str: for a in bs.find_all("a"): if "view at" in a.text.lower(): - return f"https://stockinformer.co.uk/{a.get('href')}" + url = a.get("href") + + if "stockinformer" in url: + return f"https://stockinformer.co.uk/{url}" + + return f"{url.split('?')[0]}" + return None @@ -70,8 +76,6 @@ def get_partalert_url(url: str) -> str: def check_urls(urls: List[str]): for url in urls: - print(f"Received {url}") - if "partalert" in url: url = get_partalert_url(url)