gemini test 5

This commit is contained in:
2026-01-14 15:15:38 +01:00
parent f19d939442
commit 94e8d0ecf2
+63 -63
View File
@@ -369,102 +369,102 @@ data:
- type: custom-api - type: custom-api
url: https://www.idokep.hu/idojaras/Budapest url: https://www.idokep.hu/idojaras/Budapest
cache: 15m cache: 15m
skip-json-validation: true # Mandatory for HTML scraping skip-json-validation: true
style: style:
grid-column: span 4 grid-column: span 4
grid-row: span 3 grid-row: span 3
template: | template: |
{{/* 1. Extract Current Weather Data */}} {{/* 1. Extract Body and Current Data */}}
{{ $body := .Body }} {{ $body := .Body }}
{{ $temp := findSubmatch `current-temperature">([^˚<]+)` $body }} {{ $temp := findSubmatch "current-temperature\">([^˚<]+)" $body | trimSpace }}
{{ $cond := findSubmatch `current-weather">([^<]+)</div>` $body }} {{ $cond := findSubmatch "current-weather\">([^<]+)</div>" $body | trimSpace }}
{{ $icon := findSubmatch `forecast-bigicon"[^>]+src="([^"]+)"` $body }} {{ $icon := findSubmatch "forecast-bigicon\"[^>]+src=\"([^\"]+)\"" $body }}
{{ $sunrise := findSubmatch `Napkelte ([0-9:]+)` $body }} {{ $sunrise := findSubmatch "Napkelte ([0-9:]+)" $body }}
{{ $sunset := findSubmatch `Napnyugta ([0-9:]+)` $body }} {{ $sunset := findSubmatch "Napnyugta ([0-9:]+)" $body }}
{{/* 2. Split HTML by the Forecast Column class to get daily blocks */}}
{{ $parts := split $body "<div class=\"ik dailyForecastCol\">" }}
<style> <style>
.weather-card { .weather-card {
background: rgba(0, 0, 0, 0.3); background: rgba(15, 23, 42, 0.4);
backdrop-filter: blur(12px); backdrop-filter: blur(16px);
border-radius: 1.25rem; border-radius: 1.5rem;
padding: 1.5rem; padding: 1.25rem;
color: #fff; color: #f8fafc;
font-family: ui-sans-serif, system-ui, sans-serif;
border: 1px solid rgba(255, 255, 255, 0.1);
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border: 1px solid rgba(255,255,255,0.1);
} }
.temp-now { font-size: 3.5rem; font-weight: 900; line-height: 1; letter-spacing: -2px; } .forecast-row {
.cond-now { font-size: 1rem; font-weight: 500; opacity: 0.9; margin-top: 0.25rem; }
.sun-info { display: flex; gap: 1rem; font-size: 0.75rem; opacity: 0.6; margin-top: 0.75rem; }
.forecast-table { width: 100%; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 1.25rem; padding-top: 1rem; }
.day-row {
display: grid; display: grid;
grid-template-columns: 3.8rem 2.5rem 2.5rem 1fr 2.5rem; grid-template-columns: 3.5rem 2rem 2.5rem 1fr 2.5rem;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.75rem;
padding: 0.5rem 0; padding: 0.6rem 0;
font-size: 0.85rem; border-top: 1px solid rgba(255, 255, 255, 0.05);
} }
.day-label { font-weight: 600; opacity: 0.8; } .temp-bar-bg {
.temp-min { text-align: right; opacity: 0.5; font-size: 0.8rem; } height: 6px;
.temp-max { text-align: left; font-weight: 800; font-size: 0.8rem; } background: rgba(255, 255, 255, 0.1);
.bar-bg { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; position: relative; } border-radius: 99px;
.bar-val { position: relative;
overflow: hidden;
}
.temp-bar-fill {
position: absolute; position: absolute;
height: 100%; height: 100%;
border-radius: 2px; border-radius: 99px;
background: linear-gradient(90deg, #3b82f6, #f87171); background: linear-gradient(90deg, #60a5fa, #facc15, #f87171);
left: 20%;
width: 60%;
} }
</style> </style>
<div class="weather-card"> <div class="weather-card">
{{/* Current Section */}} {{/* Current Conditions Section */}}
<div class="flex justify-between items-start"> <div class="flex justify-between items-start mb-4">
<div> <div>
<div class="text-[10px] uppercase tracking-[0.2em] opacity-50 font-black mb-1">Budapest</div> <h3 class="text-xs font-black uppercase tracking-widest opacity-40 mb-1">Budapest</h3>
<div class="temp-now">{{ $temp }}°</div> <div class="text-4xl font-extrabold tracking-tighter">{{ $temp }}°C</div>
<div class="cond-now">{{ $cond }}</div> <div class="text-sm font-medium opacity-90 mt-1">{{ $cond }}</div>
<div class="sun-info">
<span><i class="fas fa-sun"></i> ↑ {{ $sunrise }}</span>
<span><i class="fas fa-moon"></i> ↓ {{ $sunset }}</span>
</div>
</div> </div>
<img src="https://www.idokep.hu{{ $icon }}" class="w-24 h-24 -mt-2 object-contain" alt="weather"> <img src="https://www.idokep.hu{{ $icon }}" class="w-16 h-16 object-contain" alt="weather">
</div> </div>
{{/* Daily Forecast Section */}} {{/* Sunrise/Sunset info */}}
<div class="forecast-table"> <div class="flex gap-4 text-[11px] font-semibold opacity-60 mb-5">
{{/* findMatches returns a slice of the daily forecast columns */}} <span>↑ {{ $sunrise }}</span>
{{ $blocks := findMatches `(?s)<div class="ik dailyForecastCol">.*?</div>` $body }} <span>↓ {{ $sunset }}</span>
{{ range $i, $block := $blocks }} </div>
{{ if lt $i 5 }} {{/* Display only the next 5 days */}}
{{ $d_num := findSubmatch `dfDayNum">([0-9]+)` $block }}
{{ $d_name := findSubmatch `dfDay">([^<]+)` $block }}
{{ $d_icon := findSubmatch `src="([^"]+)"` $block }}
{{ $d_max := findSubmatch `max">([^<]+)</a>` $block }}
{{ $d_min := findSubmatch `min">([^<]+)</a>` $block }}
<div class="day-row"> {{/* 5-Day Forecast List */}}
<span class="day-label">{{ $d_num }} {{ $d_name }}</span> <div class="flex-grow">
<img src="https://www.idokep.hu{{ $d_icon }}" class="w-6 h-6 mx-auto object-contain"> {{ range $i := list 1 2 3 4 5 }}
<span class="temp-min">{{ $d_min }}°</span> {{ $block := index $parts $i }}
<div class="bar-bg"> {{ if $block }}
<div class="bar-val"></div> {{ $d_num := findSubmatch "dfDayNum\">([0-9]+)" $block }}
{{ $d_name := findSubmatch "dfDay\">([^<]+)" $block }}
{{ $d_icon := findSubmatch "src=\"([^\"]+)\"" $block }}
{{ $d_max := findSubmatch "class=\"max\">([^<]+)" $block }}
{{ $d_min := findSubmatch "class=\"min\">([^<]+)" $block }}
<div class="forecast-row">
<span class="text-xs font-bold whitespace-nowrap">{{ $d_num }} {{ $d_name }}</span>
<img src="https://www.idokep.hu{{ $d_icon }}" class="w-6 h-6 object-contain">
<span class="text-[11px] text-right font-medium opacity-50">{{ $d_min }}°</span>
<div class="temp-bar-bg">
<div class="temp-bar-fill" style="left: 20%; width: 60%;"></div>
</div> </div>
<span class="temp-max">{{ $d_max }}°</span> <span class="text-[11px] font-bold">{{ $d_max }}°</span>
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
{{/* Footer Link */}} {{/* Footer Link */}}
<div class="mt-auto pt-4 text-center"> <div class="mt-4 pt-2 text-center opacity-30">
<a href="https://www.idokep.hu/elorejelzes/Budapest" class="text-[9px] uppercase tracking-widest opacity-30 hover:opacity-100 transition-opacity"> <a href="https://www.idokep.hu/elorejelzes/Budapest" class="text-[9px] uppercase tracking-[0.2em] font-bold hover:opacity-100 transition-opacity">idokep.hu elorejelzes</a>
Időkép.hu Előrejelzés →
</a>
</div> </div>
</div> </div>