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