import axios from 'axios'; import * as cheerio from 'cheerio'; const homeUrl = 'https://etendersni.gov.uk/epps/home.do'; (async () => { try { const resp = await axios.get(homeUrl, { timeout: 10000 }); const $ = cheerio.load(resp.data); console.log('=== EXPLORING DIVS AND STRUCTURE ===\n'); // Look at the call_for_tenders section const callForTenders = $('#call_for_tenders_sum'); console.log('Call for tenders section:'); console.log(callForTenders.html().substring(0, 500)); console.log('\n=== ALL SCRIPTS ==='); const scripts = $('script'); scripts.each((i, el) => { const src = $(el).attr('src'); if (src) console.log('Script:', src); }); console.log('\n=== LOOKING FOR API ENDPOINTS IN JS ==='); // Look for any API calls or data attributes $('[data-*]').each((i, el) => { const attrs = el.attribs; const dataAttrs = Object.entries(attrs).filter(([k]) => k.startsWith('data-')); if (dataAttrs.length > 0) { console.log(`Element ${el.name}: ${dataAttrs.map(([k,v]) => `${k}="${v}"`).join(', ')}`); } }); // Check for onclick handlers or href patterns console.log('\n=== POTENTIAL SEARCH/BROWSE LINKS ==='); $('a, button').each((i, el) => { const onclick = $(el).attr('onclick'); const href = $(el).attr('href'); const text = $(el).text().trim().substring(0, 40); if (text.match(/tender|notice|search|browse|opportunity|list/i)) { console.log(`Text: "${text}" onclick: ${onclick} href: ${href}`); } }); } catch (e) { console.error('Error:', e.message); } })();