import axios from 'axios';
import * as cheerio from 'cheerio';
import https from 'https';

async function checkMap() {
  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 html = response.data;
    
    // Look for variables or inline JSON with coordinates
    const scriptMatches = html.match(/<script\\b[^>]*>([\\s\\S]*?)<\\/script>/gi);
    if (scriptMatches) {
        scriptMatches.forEach((m: string, i: number) => {
           if (m.includes('lat') || m.includes('Lng') || m.includes('Points') || m.includes('Markers')) {
               console.log("Found something in script " + i);
               console.log(m.substring(0, 500)); // preview
           }
        });
    }
  } catch (e: any) {
    console.error(e.message);
  }
}

checkMap();
