Compare commits
4 Commits
35d5232d8e
...
6-integer-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81c19b552d | ||
|
|
0d609ade9a | ||
|
|
2b453f4b5e | ||
|
|
62904f4c09 |
@@ -107,11 +107,11 @@ class CovidCrawler(CovidCrawlerBase):
|
||||
)
|
||||
soup = await self._fetch(url)
|
||||
|
||||
match = soup.find(class_="frame--type-textpic")
|
||||
text = match.p.text
|
||||
match = soup.find(id="c1067628")
|
||||
text = match.text.strip()
|
||||
_log.debug(f"Infection data text: {text}")
|
||||
|
||||
matches = re.search(r"(\d+,\d+)\sNeuinfektion", text)
|
||||
matches = re.search(r"(\d+(,\d+)?)\sNeuinfektion", text)
|
||||
if not matches:
|
||||
raise ValueError(
|
||||
f"Could not extract incidence from scraped web page, {text=}"
|
||||
@@ -120,18 +120,15 @@ class CovidCrawler(CovidCrawlerBase):
|
||||
incidence = parse_num(matches.group(1), t=float)
|
||||
_log.debug(f"Parsed incidence: {incidence}")
|
||||
|
||||
text = match.h2.text
|
||||
matches = re.search(r"\((\d+)\. (\w+).*\)", text)
|
||||
match = soup.find(id="c1052517")
|
||||
text = match.text.strip()
|
||||
matches = re.search(r"Stand: (\d+)\. (\w+) (\d{4})", text)
|
||||
if not matches:
|
||||
raise ValueError(f"Could not extract date from scraped web page, {text=}")
|
||||
|
||||
date = parse_date(matches.group(1), matches.group(2))
|
||||
date = parse_date(matches.group(1), matches.group(2), matches.group(3))
|
||||
_log.debug(f"Parsed date: {date}")
|
||||
|
||||
match = match.find_next_sibling(class_="frame--type-textpic")
|
||||
text = match.text
|
||||
_log.debug(f"Infection counts text: {text}")
|
||||
|
||||
regexes = [
|
||||
r"Insgesamt: (?P<total_cases>[0-9.]+)",
|
||||
r"genesen: (?P<num_recovered>[0-9.]+)",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"domain": "covid19_augsburg",
|
||||
"name": "COVID-19 Augsburg",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.3",
|
||||
"config_flow": true,
|
||||
"documentation": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg",
|
||||
"issue_tracker": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg/issues",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[tool.poetry]
|
||||
name = "git add re"
|
||||
name = "home_assistant_covid19_augsburg"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Adrian Rumpold <a.rumpold@gmail.com>"]
|
||||
|
||||
Reference in New Issue
Block a user