handle local stockinformer urls

This commit is contained in:
Giulio De Pasquale 2021-06-21 16:52:55 +01:00
parent a0243fab2f
commit 505249bcf4

10
app.py
View File

@ -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)