diff --git a/chrome-extension/content.js b/chrome-extension/content.js index 276f4ee..9db0707 100644 --- a/chrome-extension/content.js +++ b/chrome-extension/content.js @@ -8,6 +8,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.type === "extractProducts") { console.log("[Pokemon Monitor] Extracting products..."); + debugPageContent(); const products = extractProducts(); console.log("[Pokemon Monitor] Found", products.length, "products"); sendResponse(products); @@ -15,6 +16,41 @@ return true; }); + // Debug function to see what's on the page + function debugPageContent() { + console.log("[Pokemon Monitor] === PAGE DEBUG ==="); + console.log("[Pokemon Monitor] Title:", document.title); + console.log("[Pokemon Monitor] Body text length:", document.body?.textContent?.length || 0); + + // Check for bot protection indicators + const bodyText = document.body?.textContent?.toLowerCase() || ""; + if (bodyText.includes("verify") || bodyText.includes("robot") || bodyText.includes("captcha")) { + console.log("[Pokemon Monitor] WARNING: Possible bot protection detected!"); + } + + // Count all links + const allLinks = document.querySelectorAll('a'); + console.log("[Pokemon Monitor] Total links on page:", allLinks.length); + + // Check for product links with various patterns + const productLinks = document.querySelectorAll('a[href*="/product/"]'); + console.log("[Pokemon Monitor] Links with /product/:", productLinks.length); + + // Try alternative selectors + const cardLinks = document.querySelectorAll('[class*="product"] a, [class*="card"] a, [class*="tile"] a'); + console.log("[Pokemon Monitor] Links in product/card/tile containers:", cardLinks.length); + + // Sample some hrefs to understand page structure + const sampleHrefs = Array.from(allLinks).slice(0, 10).map(a => a.href); + console.log("[Pokemon Monitor] Sample hrefs:", sampleHrefs); + + // Look for any elements that might be products + const possibleProducts = document.querySelectorAll('[class*="product"], [class*="card"], [data-product], [data-item]'); + console.log("[Pokemon Monitor] Elements with product/card classes:", possibleProducts.length); + + console.log("[Pokemon Monitor] === END DEBUG ==="); + } + function extractProducts() { const products = [];