Files
davisfe.cz/scripts/test_pvl.ts
T
David Fencl a67a2247c3
continuous-integration/drone/push Build encountered an error
feat: import new reservoir data, add lake management scripts, and update overview UI components
2026-06-06 20:14:36 +02:00

33 lines
1.0 KiB
TypeScript

import axios from 'axios';
import * as cheerio from 'cheerio';
import https from 'https';
async function checkLake() {
const agent = new https.Agent({ rejectUnauthorized: false });
// Check Lipno 1
const url = `https://www.pvl.cz/portal/nadrze/cz/pc/Mereni.aspx?id=VLL1&oid=1`;
try {
const response = await axios.get(url, {
httpsAgent: agent,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}
});
const $ = cheerio.load(response.data);
let hasData = false;
$('table').each((i, tbl) => {
const firstRowText = $(tbl).find('tr').first().text();
console.log(`Table ${i} first row:`, firstRowText.trim().replace(/\\s+/g, ' '));
if (firstRowText.includes('Datum a čas') || firstRowText.includes('Hladina')) {
hasData = true;
}
});
console.log(`hasData=${hasData}`);
} catch (err: any) {
console.error(err.message);
}
}
checkLake();