import axios from 'axios'; import * as cheerio from 'cheerio'; async function testScraper() { const url = 'https://manhwaweb.com/manga/one-piece_1695365223767'; try { const response = await axios.get(url, { headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' } }); const $ = cheerio.load(response.data); console.log('=== Título de la página ==='); console.log($('title').text()); console.log('\n'); console.log('=== Buscando enlaces con /leer/ ==='); const leerLinks = []; $('a').each((i, el) => { const href = $(el).attr('href'); if (href && href.includes('/leer/')) { leerLinks.push({ href: href, text: $(el).text().trim() }); } }); console.log(`Encontrados ${leerLinks.length} enlaces:`); leerLinks.slice(0, 10).forEach(link => { console.log(` - ${link.href}: "${link.text}"`); }); console.log('\n=== HTML sample around "Capitulo" ==='); const html = response.data; const capIndex = html.indexOf('Capitulo 1'); if (capIndex > 0) { console.log(html.substring(capIndex - 200, capIndex + 400)); } } catch (error) { console.error('Error:', error.message); } } testScraper();