38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import axios from 'axios';
|
|
import * as cheerio from 'cheerio';
|
|
import https from 'https';
|
|
|
|
async function test() {
|
|
const agent = new https.Agent({ rejectUnauthorized: false });
|
|
try {
|
|
const res = await axios.get('https://www.pvl.cz/portal/nadrze/cz/pc/Mereni.aspx?oid=1&id=VLL1', {
|
|
httpsAgent: agent,
|
|
headers: {
|
|
'User-Agent': 'Mozilla/5.0'
|
|
}
|
|
});
|
|
|
|
const $ = cheerio.load(res.data);
|
|
console.log('Inputs:');
|
|
$('input').each((i, el) => {
|
|
console.log(`Type: ${$(el).attr('type')}, Name: ${$(el).attr('name')}, Value: ${$(el).attr('value')}, ID: ${$(el).attr('id')}`);
|
|
});
|
|
|
|
console.log('\nButtons/Links with postback:');
|
|
$('a[href*="__doPostBack"]').each((i, el) => {
|
|
console.log(`Text: ${$(el).text()}, Href: ${$(el).attr('href')}`);
|
|
});
|
|
const tables = $('table');
|
|
tables.each((i, tbl) => {
|
|
console.log(`TABLE ${i}:`);
|
|
console.log($(tbl).find('tr').first().text().trim().replace(/\s+/g, ' '));
|
|
console.log($(tbl).find('tr').eq(1).text().trim().replace(/\s+/g, ' '));
|
|
console.log('---');
|
|
});
|
|
|
|
} catch (e) {
|
|
console.error(e.message);
|
|
}
|
|
}
|
|
test();
|