{
  "version": "1.0.0",
  "exported_at": "2026-06-01T04:50:00.000Z",
  "project": {
    "name": "Amazon Product Details Scraper for Spain",
    "description": "Scrapes Amazon.es product detail pages by ASIN. Uses multi-URL navigation with loop-continue so each https://www.amazon.es/dp/{ASIN} URL is opened and appended to one CSV. No listing pagination is present; navigation is across the ASIN/product URL input list. Best-effort template: Amazon may show cookie consent, CAPTCHA, bot checks, regional delivery differences, recommendation widgets, or unavailable-product layouts. Price extraction is restricted to main product/buy-box containers to avoid pulling prices from recommendation widgets.",
    "color": "bg-[#ff9900]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser window dimensions",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "width": 1920,
        "height": 1080,
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 480,
      "position_y": 220,
      "config": {
        "urls": [
          "https://www.amazon.es/dp/B089YS7L5W",
          "https://www.amazon.es/dp/B089YRSTWH",
          "https://www.amazon.es/dp/B089YSYPYP",
          "https://www.amazon.es/dp/B089YS132V",
          "https://www.amazon.es/dp/B089YRSSYD"
        ],
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "timeout": 45
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "selector": "#sp-cc-accept"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 1560,
      "position_y": 220,
      "config": {
        "selector": "#sp-cc-accept",
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1920,
      "position_y": 220,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 2280,
      "position_y": 220,
      "config": {
        "selector": "body",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 540,
      "config": {
        "selector": "body",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 2640,
      "position_y": 380,
      "config": {
        "rowSelector": "body",
        "fileName": "amazon-producto-detalles-scraper-asin.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "ASIN",
            "selector": "(() => { const m = location.pathname.match(/\\/(?:dp|gp\\/product)\\/([A-Z0-9]{10})/i); if (m) return m[1].toUpperCase(); const txt = document.body.innerText || ''; const m2 = txt.match(/ASIN\\s*[:：]?\\s*([A-Z0-9]{10})/i); return m2 ? m2[1].toUpperCase() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Web_Page_URL",
            "selector": "location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Title",
            "selector": "#productTitle",
            "attribute": "text"
          },
          {
            "name": "Brand",
            "selector": "#bylineInfo",
            "attribute": "text"
          },
          {
            "name": "Star_Rating",
            "selector": "#acrPopover .a-icon-alt, #averageCustomerReviews .a-icon-alt",
            "attribute": "text"
          },
          {
            "name": "Number_of_Reviews",
            "selector": "(() => { const t = document.querySelector('#acrCustomerReviewText')?.textContent || ''; const m = t.match(/[\\d.,]+/); return m ? m[0] : t.trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Number_of_Answered_Questions",
            "selector": "(() => { const texts = Array.from(document.querySelectorAll('a, span')).map(e => (e.textContent || '').replace(/\\s+/g, ' ').trim()).filter(Boolean); const hit = texts.find(t => /preguntas?\\s+(respondidas?|contestadas?)|answered\\s+questions/i.test(t)); const m = hit && hit.match(/[\\d.,]+/); return m ? m[0] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Price",
            "selector": "(() => { const selectors = ['#corePrice_feature_div .a-price .a-offscreen', '#corePriceDisplay_desktop_feature_div .a-price .a-offscreen', '#apex_desktop .a-price .a-offscreen', '#tp_price_block_total_price_ww .a-price .a-offscreen', '#priceblock_ourprice', '#priceblock_dealprice', '#price_inside_buybox']; for (const s of selectors) { const el = document.querySelector(s); const txt = (el?.textContent || '').replace(/\\s+/g, ' ').trim(); if (txt && /[0-9]/.test(txt)) return txt; } return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Precio_Envio",
            "selector": "#mir-layout-DELIVERY_BLOCK-slot-PRIMARY_DELIVERY_MESSAGE_LARGE, #deliveryBlockMessage, #mir-layout-DELIVERY_BLOCK",
            "attribute": "text"
          },
          {
            "name": "Style",
            "selector": "#variation_style_name .selection, #variation_size_name .selection",
            "attribute": "text"
          },
          {
            "name": "Color",
            "selector": "#variation_color_name .selection",
            "attribute": "text"
          },
          {
            "name": "Inventory",
            "selector": "(() => { const txt = (document.querySelector('#availability span, #outOfStock')?.textContent || '').replace(/\\s+/g, ' ').trim(); if (txt) return txt; const body = document.body.innerText || ''; if (/No disponible/i.test(body)) return 'No disponible'; if (/En stock/i.test(body)) return 'En stock'; return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Seller",
            "selector": "#sellerProfileTriggerId, #merchant-info",
            "attribute": "text"
          },
          {
            "name": "Bullet_Points",
            "selector": "#feature-bullets",
            "attribute": "text"
          },
          {
            "name": "Product_Information",
            "selector": "(() => { const parts = ['#productOverview_feature_div', '#productFactsDesktopExpander', '#prodDetails', '#productDetails_techSpec_section_1', '#productDetails_detailBullets_sections1'].map(s => document.querySelector(s)?.innerText || '').filter(Boolean); return [...new Set(parts.map(t => t.replace(/\\s+/g, ' ').trim()))].join(' | '); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Product_Description",
            "selector": "#productDescription, #aplus",
            "attribute": "text"
          },
          {
            "name": "Product_Details",
            "selector": "(() => { const parts = ['#detailBullets_feature_div', '#productDetails_detailBullets_sections1', '#productDetails_techSpec_section_1', '#productDetails_db_sections', '#prodDetails'].map(s => document.querySelector(s)?.innerText || '').filter(Boolean); return [...new Set(parts.map(t => t.replace(/\\s+/g, ' ').trim()))].join(' | '); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Item_Model_Number",
            "selector": "(() => { const norm = s => (s || '').replace(/\\s+/g, ' ').trim(); const labels = ['Número de modelo del producto', 'Numero de modelo del producto', 'Referencia del fabricante', 'Número de pieza', 'Numero de pieza', 'Item model number']; const rows = Array.from(document.querySelectorAll('#productDetails_techSpec_section_1 tr, #productDetails_detailBullets_sections1 tr, #productDetails_db_sections tr, #prodDetails tr')); for (const r of rows) { const k = norm(r.querySelector('th')?.textContent); const v = norm(r.querySelector('td')?.textContent); if (labels.some(l => k.toLowerCase().includes(l.toLowerCase()))) return v; } const text = norm(document.querySelector('#detailBullets_feature_div')?.innerText); for (const l of labels) { const re = new RegExp(l + '\\\\s*[:：]\\\\s*([^\\\\n|]+)', 'i'); const m = text.match(re); if (m) return m[1].trim(); } return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Item_Weight",
            "selector": "(() => { const norm = s => (s || '').replace(/\\s+/g, ' ').trim(); const labels = ['Peso del producto', 'Peso', 'Item Weight']; const rows = Array.from(document.querySelectorAll('#productDetails_techSpec_section_1 tr, #productDetails_detailBullets_sections1 tr, #productDetails_db_sections tr, #prodDetails tr')); for (const r of rows) { const k = norm(r.querySelector('th')?.textContent); const v = norm(r.querySelector('td')?.textContent); if (labels.some(l => k.toLowerCase().includes(l.toLowerCase()))) return v; } const details = norm(document.querySelector('#detailBullets_feature_div')?.innerText); let m = details.match(/Peso del producto\\s*[:：]\\s*([^\\n|]+)/i); if (m) return m[1].trim(); m = details.match(/;\\s*([\\d.,]+\\s*(?:g|kg|gramos|kilogramos))\\b/i); return m ? m[1].trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Clasificacion_en_los_mas_vendidos_de_Amazon",
            "selector": "(() => { const norm = s => (s || '').replace(/\\s+/g, ' ').trim(); const labels = ['Clasificación en los más vendidos de Amazon', 'Clasificacion en los mas vendidos de Amazon', 'Best Sellers Rank']; const rows = Array.from(document.querySelectorAll('#productDetails_detailBullets_sections1 tr, #productDetails_db_sections tr, #prodDetails tr')); for (const r of rows) { const k = norm(r.querySelector('th')?.textContent); const v = norm(r.querySelector('td')?.textContent); if (labels.some(l => k.toLowerCase().includes(l.toLowerCase()))) return v; } const text = norm(document.querySelector('#detailBullets_feature_div')?.innerText); const m = text.match(/Clasificaci[oó]n en los m[aá]s vendidos de Amazon\\s*[:：]\\s*([^|]+)/i); return m ? m[1].trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Current_Time",
            "selector": "new Date().toISOString().replace('T', ' ').substring(0, 19)",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Image_URL_1",
            "selector": "(() => { const urls = Array.from(document.querySelectorAll('#altImages img, #imageBlock img, #imgTagWrapperId img')).map(img => img.getAttribute('data-old-hires') || img.getAttribute('data-a-hires') || img.getAttribute('src') || '').filter(u => u && /m\\.media-amazon\\.com/.test(u) && !/transparent|sprite|play-button/i.test(u)); return Array.from(new Set(urls))[0] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Image_URL_2",
            "selector": "(() => { const urls = Array.from(document.querySelectorAll('#altImages img, #imageBlock img, #imgTagWrapperId img')).map(img => img.getAttribute('data-old-hires') || img.getAttribute('data-a-hires') || img.getAttribute('src') || '').filter(u => u && /m\\.media-amazon\\.com/.test(u) && !/transparent|sprite|play-button/i.test(u)); return Array.from(new Set(urls))[1] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Image_URL_3",
            "selector": "(() => { const urls = Array.from(document.querySelectorAll('#altImages img, #imageBlock img, #imgTagWrapperId img')).map(img => img.getAttribute('data-old-hires') || img.getAttribute('data-a-hires') || img.getAttribute('src') || '').filter(u => u && /m\\.media-amazon\\.com/.test(u) && !/transparent|sprite|play-button/i.test(u)); return Array.from(new Set(urls))[2] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "Image_URL_4",
            "selector": "(() => { const urls = Array.from(document.querySelectorAll('#altImages img, #imageBlock img, #imgTagWrapperId img')).map(img => img.getAttribute('data-old-hires') || img.getAttribute('data-a-hires') || img.getAttribute('src') || '').filter(u => u && /m\\.media-amazon\\.com/.test(u) && !/transparent|sprite|play-button/i.test(u)); return Array.from(new Set(urls))[3] || ''; })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3000,
      "position_y": 380,
      "config": {
        "duration": 3
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 3360,
      "position_y": 380,
      "config": {}
    }
  ],
  "connections": [
    {
      "from_block_id": "set-window-size-1",
      "from_connector_id": "right",
      "to_block_id": "navigate-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "navigate-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-page-load-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-page-load-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "true",
      "to_block_id": "click-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "wait-for-element-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "click-1",
      "from_connector_id": "right",
      "to_block_id": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-1",
      "from_connector_id": "right",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-2",
      "from_connector_id": "right",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "sleep-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-2",
      "from_connector_id": "right",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 48,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "set-window-size-1"
        ]
      }
    },
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 408,
      "position_y": 116,
      "width": 2840,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "wait-for-element-2",
          "sleep-2"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1128,
      "position_y": 116,
      "width": 2480,
      "height": 456,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1",
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 2568,
      "position_y": 276,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Amazon.es product detail pages by ASIN. Uses multi-URL navigation with loop-continue so each https://www.amazon.es/dp/{ASIN} URL is opened and appended to one CSV. No listing pagination is present; navigation is across the ASIN/product URL input list. Best-effort template: Amazon may show cookie consent, CAPTCHA, bot checks, regional delivery differences, recommendation widgets, or unavailable-product layouts. Price extraction is restricted to main product/buy-box containers to avoid pulling prices from recommendation widgets.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `#sp-cc-accept`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1400,
      "position_y": 200,
      "width": 340,
      "height": 134,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (ASIN, Web_Page_URL, Number_of_Reviews, Number_of_Answered_Questions, Price). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2840,
      "position_y": 360,
      "width": 340,
      "height": 138,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-loop-continue-1",
      "element_type": "note",
      "title": "Note: Loop Continue",
      "content": "Loop Continue advances a multi-URL or multi-text loop. Place at the end of the loop body with a clear back-edge to the loop start.",
      "color": "#ee5396",
      "position_x": 3560,
      "position_y": 360,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}