diff --git a/content.js b/content.js index f17c987..bd531a1 100644 --- a/content.js +++ b/content.js @@ -320,22 +320,40 @@ const allDivs = doc.querySelectorAll('div'); console.log(`🔍 Buscando en ${allDivs.length} divs...`); + const potentialMatches = []; + for (let div of allDivs) { const text = div.textContent.trim(); // Patrón específico: número seguido de "pages" o "page" const pageMatch = text.match(/^(\d+)\s+pages?$/i); if (pageMatch) { const pageCount = parseInt(pageMatch[1]); + potentialMatches.push({ + div: div, + text: text, + count: pageCount, + className: div.className, + id: div.id + }); + console.log(`🔍 Found potential match: "${text}" -> ${pageCount} pages (class: ${div.className}, id: ${div.id})`); + // Validar que sea un número razonable (1-100 páginas) if (pageCount > 0 && pageCount <= 100) { actualTotalPages = pageCount; foundPageCount = true; - console.log(`✓ Patrón específico "X pages": ${actualTotalPages} páginas (div: ${div.className})`); + console.log(`✓✅ ACCEPTED: "${text}" -> ${actualTotalPages} páginas (class: ${div.className})`); break; + } else { + console.log(`❌ REJECTED: ${pageCount} pages (out of range 1-100)`); } } } + console.log(`📊 Total potential matches found: ${potentialMatches.length}`); + if (potentialMatches.length > 0) { + console.log('📋 All matches:', potentialMatches); + } + // Si no se encontró, usar patrones alternativos if (!foundPageCount) { console.log('⚠️ No se encontró patrón específico, buscando alternativas...');