Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Fix scraping, format changed again
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Apr 2, 2020
1 parent 3f3fd68 commit d4a53e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/coronavirus_hessen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ async def async_get_data():

for row in rows[1:]:
line = row.select("td")
if len(line) != 4:
if len(line) != 5:
continue

try:
county = line[0].text.strip()
cases = parse_num(line[1].text.strip())
deaths = parse_num(line[3].text.strip())
deaths = parse_num(line[2].text.strip())
except:
_LOGGER.exception("Error processing line {}, skipping".format(line))
continue
Expand All @@ -107,4 +107,4 @@ async def async_get_data():
def parse_num(s, t=int):
if len(s) and s != "-":
return t(s.replace(".", "").replace(",", "."))
return 0
return 0

0 comments on commit d4a53e6

Please sign in to comment.