diff --git a/glance-system/glance-kisfenyo.yaml b/glance-system/glance-kisfenyo.yaml index c22cc51..0a47a49 100644 --- a/glance-system/glance-kisfenyo.yaml +++ b/glance-system/glance-kisfenyo.yaml @@ -369,84 +369,69 @@ data: - type: custom-api url: https://www.idokep.hu/idojaras/Budapest cache: 15m + skip-json-validation: true # CRITICAL: Fixes the JSON error style: grid-column: span 4 grid-row: span 3 template: | - {{/* 1. Extract Current Data */}} + {{/* 1. Extract Current Weather Data */}} {{ $body := .Body }} - {{ $temp := findSubmatch `(?s)current-temperature">([^˚<]+)` $body | trimSpace }} - {{ $cond := findSubmatch `(?s)current-weather">([^<]+)` $body | trimSpace }} - {{ $icon := findSubmatch `(?s)forecast-bigicon"[^>]+src="([^"]+)"` $body }} + {{ $temp := findSubmatch `current-temperature">([^˚<]+)` $body }} + {{ $cond := findSubmatch `current-weather">([^<]+)` $body }} + {{ $icon := findSubmatch `forecast-bigicon"[^>]+src="([^"]+)"` $body }} {{ $sunrise := findSubmatch `Napkelte ([0-9:]+)` $body }} {{ $sunset := findSubmatch `Napnyugta ([0-9:]+)` $body }} - {{/* 2. Extract Daily Forecast (Regex patterns for specific day indices) */}} - {{/* Day 1 */}} - {{ $d1_pat := `(?s)dailyForecastCol.*?dfDayNum">([0-9]+).*?dfDay">([^<]+).*?src="([^"]+)".*?max[^>]+>([^<]+).*?min[^>]+>([^<]+)` }} - {{ $d1_num := findSubmatch $d1_pat $body }} - {{ $d1_day := index (findSubmatch $d1_pat $body) 1 }} - {{ $d1_icon := index (findSubmatch $d1_pat $body) 2 }} - {{ $d1_max := index (findSubmatch $d1_pat $body) 3 }} - {{ $d1_min := index (findSubmatch $d1_pat $body) 4 }} - - {{/* Day 2 (skipping 1 column) */}} - {{ $d2_pat := `(?s)dailyForecastCol.*?dailyForecastCol.*?dfDayNum">([0-9]+).*?dfDay">([^<]+).*?src="([^"]+)".*?max[^>]+>([^<]+).*?min[^>]+>([^<]+)` }} - {{ $d2_day := index (findSubmatch $d2_pat $body) 1 }} - {{ $d2_icon := index (findSubmatch $d2_pat $body) 2 }} - {{ $d2_max := index (findSubmatch $d2_pat $body) 3 }} - {{ $d2_min := index (findSubmatch $d2_pat $body) 4 }} - -
+
-
Budapest
-
{{ now | formatTime "Monday, Jan 02" }}
+
Budapest
+
{{ now | formatTime "Monday, Jan 02" }}
+
+
+
↑ {{ $sunrise }}
+
↓ {{ $sunset }}
-
{{ $temp }}°
-
- weather -
{{ $cond }}
+ icon +
+
{{ $temp }}°
+
{{ $cond }}
-
- ↑ {{ $sunrise }} - ↓ {{ $sunset }} -
- - {{/* Daily Forecast Rows (Day 1 and 2 shown as examples) */}} -
- {{ $d1_day }} - - {{ $d1_min }}° -
- {{ $d1_max }}° -
- -
- {{ $d2_day }} - - {{ $d2_min }}° -
- {{ $d2_max }}° -
- -
- idokep.hu 30 napos → +
+ {{/* Loop through daily forecast columns found in the HTML */}} + {{ $dayBlocks := findAllMatches `(?s)
.*?
` $body }} + {{ range $i, $block := $dayBlocks }} + {{ if lt $i 5 }} {{/* Show only next 5 days */}} + {{ $d_num := findSubmatch `dfDayNum">([0-9]+)` $block }} + {{ $d_name := findSubmatch `dfDay">([^<]+)` $block }} + {{ $d_icon := findSubmatch `src="([^"]+)"` $block }} + {{ $d_max := findSubmatch `max[^>]+>([^<]+)` $block }} + {{ $d_min := findSubmatch `min[^>]+>([^<]+)` $block }} + +
+ {{ $d_num }} {{ $d_name }} + + {{ $d_min }}° +
+ {{ $d_max }}° +
+ {{ end }} + {{ end }}