feat: import new reservoir data, add lake management scripts, and update overview UI components
continuous-integration/drone/push Build encountered an error
continuous-integration/drone/push Build encountered an error
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import axios from 'axios';
|
||||
import * as cheerio from 'cheerio';
|
||||
import https from 'https';
|
||||
|
||||
async function fetchLakes() {
|
||||
const agent = new https.Agent({ rejectUnauthorized: false });
|
||||
try {
|
||||
const response = await axios.get('https://www.pvl.cz/portal/nadrze/cz/pc/Prehled.aspx', {
|
||||
httpsAgent: agent,
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0'
|
||||
}
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const lakes: any[] = [];
|
||||
|
||||
// Links to lakes usually look like Mereni.aspx?oid=xxx&id=yyy
|
||||
$('a[href^="Mereni.aspx"]').each((i, el) => {
|
||||
const href = $(el).attr('href');
|
||||
const text = $(el).text().trim();
|
||||
if (href && text) {
|
||||
lakes.push({ href, text });
|
||||
}
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(lakes, null, 2));
|
||||
} catch (err: any) {
|
||||
console.error('Error:', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
fetchLakes();
|
||||
Reference in New Issue
Block a user