const cheerio = require('cheerio'); const fs = require('fs'); const html = fs.readFileSync('mega01.html', 'utf8'); const $ = cheerio.load(html); console.log('--- Page Title ---'); console.log($('title').text()); console.log('\n--- Main Content Sections ---'); const sections = []; $('section, .section, [data-section]').each((i, el) => { sections.push({ index: i + 1, id: $(el).attr('id') || 'no-id', class: $(el).attr('class') || 'no-class', text: $(el).text().replace(/\s+/g, ' ').substring(0, 500) }); }); if (sections.length === 0) { // If no semantic tags, maybe just print divs with specific classes $('div').each((i, el) => { if($(el).attr('class') && $(el).attr('class').includes('py-')) { sections.push({ index: i + 1, class: $(el).attr('class') || 'no-class', text: $(el).text().replace(/\s+/g, ' ').substring(0, 500) }); } }); } console.log(JSON.stringify(sections, null, 2));