Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d20b48e6b1 | ||
|
|
d1438f9a0b | ||
|
|
c1b7b16251 | ||
|
|
e6c2644ea5 | ||
|
|
fc5f6e7c93 | ||
|
|
fa052cdfc9 | ||
|
|
f6f799e85f |
@@ -16,7 +16,7 @@ from .crawler import CovidCrawler
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
__version__ = "0.1.0"
|
||||
__version__ = "1.2.2"
|
||||
|
||||
PLATFORMS = ["sensor"]
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class CovidCrawler(CovidCrawlerBase):
|
||||
)
|
||||
soup = await self._fetch(url)
|
||||
|
||||
match = soup.find(id="c1067628")
|
||||
match = soup.find(id="c1075340")
|
||||
text = match.text.strip()
|
||||
_log.debug(f"Infection data text: {text}")
|
||||
|
||||
@@ -167,9 +167,9 @@ class CovidCrawler(CovidCrawlerBase):
|
||||
result = soup.find(id=container_id)
|
||||
text = re.sub(r"\s+", " ", result.text)
|
||||
regexes = [
|
||||
r"(?P<total_vaccinations>\d+([.]\d+)?) Personen in Augsburg mindestens",
|
||||
r"(?P<num_vaccinated_full>\d+([.]\d+)?) Personen sind mindestens zweimal geimpft",
|
||||
r"(?P<num_vaccinated_booster>\d+([.]\d+)?) Personen haben eine Auffrischungsimpfung",
|
||||
r"(?P<total_vaccinations>\d+([.]\d+)?) Personen in Augsburg",
|
||||
r"(?P<num_vaccinated_full>\d+([.]\d+)?) Personen in Augsburg",
|
||||
r"(?P<num_vaccinated_booster>\d+([.]\d+)?) Personen, also",
|
||||
]
|
||||
values = {}
|
||||
for r in regexes:
|
||||
@@ -187,8 +187,8 @@ class CovidCrawler(CovidCrawlerBase):
|
||||
if not matches:
|
||||
raise ValueError(f"Could not extract date from scraped web page, {text=}")
|
||||
|
||||
values["num_vaccinated_once"] = values["total_vaccinations"] - (
|
||||
values["num_vaccinated_full"] + values["num_vaccinated_booster"]
|
||||
values["num_vaccinated_once"] = (
|
||||
values["total_vaccinations"] - values["num_vaccinated_full"]
|
||||
)
|
||||
|
||||
values["date"] = parse_date(**matches.groupdict()).strftime("%Y-%m-%d")
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
{
|
||||
"domain": "covid19_augsburg",
|
||||
"name": "COVID-19 Augsburg",
|
||||
"version": "1.2.0",
|
||||
"config_flow": true,
|
||||
"documentation": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg",
|
||||
"issue_tracker": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg/issues",
|
||||
"requirements": ["beautifulsoup4==4.8.2"],
|
||||
"dependencies": [],
|
||||
"codeowners": ["@AdrianoKF"]
|
||||
}
|
||||
"domain": "covid19_augsburg",
|
||||
"name": "COVID-19 Augsburg",
|
||||
"version": "1.2.2",
|
||||
"config_flow": true,
|
||||
"documentation": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg",
|
||||
"issue_tracker": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg/issues",
|
||||
"requirements": [
|
||||
"beautifulsoup4==4.8.2"
|
||||
],
|
||||
"dependencies": [],
|
||||
"codeowners": [
|
||||
"@AdrianoKF"
|
||||
]
|
||||
}
|
||||
1021
poetry.lock
generated
1021
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "home_assistant_covid19_augsburg"
|
||||
version = "0.1.0"
|
||||
version = "1.2.2"
|
||||
description = ""
|
||||
authors = ["Adrian Rumpold <a.rumpold@gmail.com>"]
|
||||
packages = [
|
||||
|
||||
Reference in New Issue
Block a user