ADSB & Seismic fixes
This commit is contained in:
@@ -170,34 +170,6 @@ export function classifyAircraft(row) {
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
async function scrapeHexDatabase(icao) {
|
||||
const url = `https://hexdatabase.com/h/${icao}`;
|
||||
try {
|
||||
const resp = await fetch(url);
|
||||
if (!resp.ok) return null;
|
||||
const html = await resp.text();
|
||||
const rowMatch = html.match(new RegExp(`<tr[^>]*>.*?<span[^>]*>.*?${icao}.*?<\/span>.*?<\/tr>`, 's'));
|
||||
if (!rowMatch) return null;
|
||||
// 0: Hex (ICAO), 1: Co (Country), 2: Reg (Registration), 3: Atype (Aircraft Type), 4: Operator, 5: Source, 6: MSN (Serial number), 7: Remarks (Description)
|
||||
const cells = rowMatch.match(/<td[^>]*>.*?<\/td>/g) || [] || null;
|
||||
const country = cells[1]?.replace(/<[^>]*>/g, '').trim() || null;
|
||||
const registration = cells[2]?.replace(/<[^>]*>/g, '').trim() || null;
|
||||
const aircraft = cells[3]?.replace(/<[^>]*>/g, '').trim() || null;
|
||||
const operator = cells[4]?.replace(/<[^>]*>/g, '').trim() || null;
|
||||
const serialNumber = cells[6]?.replace(/<[^>]*>/g, '').trim() || null;
|
||||
|
||||
return {
|
||||
country,
|
||||
registration,
|
||||
aircraft,
|
||||
operator,
|
||||
serialNumber
|
||||
};
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function scrapeHexDatabase(icao) {
|
||||
const url = `https://hexdatabase.com/h/${icao}`;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user