Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.8 (2025-12-09)
### Fixed
- Fix TH pegel page scraping

## 1.0.7 (2025-11-23)
### Fixed
- Fix HE without flow
Expand Down
2 changes: 1 addition & 1 deletion docs/update_pegel_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def get_th_stations() -> tuple[str, str]:
trs = tbody.find_all("tr")
for row in trs:
tds = row.find_all("td")
if len(tds) > 10:
if len(tds) > 3:
ident = "TH_" + tds[1].getText().strip()
name = tds[2].getText().strip() + " / " + tds[3].getText().strip()
stations.append((ident, name))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "lhpapi"
version = "1.0.7"
version = "1.0.8"
authors = [
{ name="stephan192", email="stephan192@outlook.com" },
]
Expand Down
12 changes: 6 additions & 6 deletions src/lhpapi/th_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def init_TH(ident: str) -> StaticData: # pylint: disable=invalid-name
# Parse data
for row in trs:
tds = row.find_all("td")
if len(tds) > 10:
if len(tds) > 3:
if tds[1].getText().strip() != ident[3:]:
continue
links = tds[1].find_all("a")
Expand All @@ -49,10 +49,10 @@ def update_TH(static_data: StaticData) -> DynamicData: # pylint: disable=invali
# Parse data
for row in trs:
tds = row.find_all("td")
if len(tds) > 10:
if len(tds) > 11:
if tds[1].getText().strip() != static_data.ident[3:]:
continue
if str(tds[6]).find("Hochwassermeldepegel") != -1:
if str(tds[7]).find("Hochwassermeldepegel") != -1:
if "w3-purple" in row["class"]:
stage = 4
elif "w3-red" in row["class"]:
Expand All @@ -66,10 +66,10 @@ def update_TH(static_data: StaticData) -> DynamicData: # pylint: disable=invali
else:
stage = None
last_update = convert_to_datetime(
tds[7].getText().strip(), "%d.%m.%Y %H:%M"
tds[8].getText().strip(), "%d.%m.%Y %H:%M"
)
level = convert_to_float(tds[8].getText().strip(), True)
flow = convert_to_float(tds[10].getText().strip(), True)
level = convert_to_float(tds[9].getText().strip(), True)
flow = convert_to_float(tds[11].getText().strip(), True)
return DynamicData(
level=level, stage=stage, flow=flow, last_update=last_update
)
Expand Down