{
  "version": "1.0.0",
  "exported_at": "2026-06-03T05:45:00.000Z",
  "project": {
    "name": "Elektra Listing Scraper",
    "description": "Extracts Elektra México listing product data equivalent to the Octoparse Elektra Listing Scraper: title, current price, original price, weekly loan/payment text, image URL, and product URL. The workflow navigates the supplied Elektra listing/category URLs, attempts to dismiss location prompts, scrolls and clicks VTEX 'Mostrar más / Ver más / Cargar más' buttons until no more are found, then appends all products into one CSV. Price parsing removes decimal MSI installment amounts such as product-price divided by 3, 6, 12, or 24 before exporting the actual product prices. If CAPTCHA appears, manual solving may be required.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 120,
      "position_y": 180,
      "config": {
        "urls": [
          "https://www.elektra.mx/muebles/recamara/cajoneras-y-comodas",
          "https://www.elektra.mx/linea-blanca/climatizacion-y-ventilacion/ventil",
          "https://www.elektra.mx/zapatos/zapatos-de-mujer/botines"
        ],
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 480,
      "position_y": 180,
      "config": {
        "timeout": 40
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 840,
      "position_y": 180,
      "config": {
        "jsCode": "(() => { const candidates = Array.from(document.querySelectorAll('button, [role=\"button\"], a')); const btn = candidates.find(el => /No,?\\s*gracias|Ahora no|Cerrar/i.test((el.textContent || '').trim())); if (btn) { btn.click(); return 'dismissed optional prompt'; } return 'no prompt found'; })();",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1200,
      "position_y": 180,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 180,
      "config": {
        "selector": "a.vtex-product-summary-2-x-clearLink[href*=\"/p\"]",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "scroll-1",
      "block_type": "process",
      "title": "Scroll",
      "description": "Scroll the page or element",
      "position_x": 1920,
      "position_y": 180,
      "config": {
        "direction": "down",
        "amount": 1600
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2280,
      "position_y": 180,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 2640,
      "position_y": 180,
      "config": {
        "selector": "//button[not(@disabled) and (contains(normalize-space(.), 'Mostrar más') or contains(normalize-space(.), 'Ver más') or contains(normalize-space(.), 'Cargar más'))] | //div[contains(@class,'vtex-search-result-3-x-buttonShowMore')]//button[not(@disabled)]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 3000,
      "position_y": 500,
      "config": {
        "selector": "//button[not(@disabled) and (contains(normalize-space(.), 'Mostrar más') or contains(normalize-space(.), 'Ver más') or contains(normalize-space(.), 'Cargar más'))] | //div[contains(@class,'vtex-search-result-3-x-buttonShowMore')]//button[not(@disabled)]",
        "timeout": 15
      }
    },
    {
      "block_id": "sleep-3",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3360,
      "position_y": 500,
      "config": {
        "duration": 3
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 2640,
      "position_y": 860,
      "config": {
        "rowSelector": "a.vtex-product-summary-2-x-clearLink[href*=\"/p\"]",
        "fileName": "elektra-detalles-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "titulo",
            "selector": "(() => { const el = ROW.querySelector('h3,[class*=\"productBrand\"],[class*=\"productName\"],[class*=\"nameContainer\"]'); if (el && el.textContent.trim()) return el.textContent.replace(/\\s+/g,' ').trim(); const txt = ROW.innerText.replace(/\\s+/g,' ').trim(); return txt.split(/\\bDesde\\b|\\$|\\bHasta\\b|-[0-9]+%/)[0].trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "precio",
            "selector": "(() => { const txt = ROW.innerText.replace(/\\s+/g,' ').trim(); const clean = s => (s || '').replace(/\\s+/g,'').trim(); const toNum = p => Number(clean(p).replace(/[$,]/g,'')); const hasCents = p => /\\.\\d{2}$/.test(clean(p)); const afterLoan = (txt.match(/semanas\\s+(.+)/i) || [null, txt])[1]; const priceArea = afterLoan.split(/Agregar|Envío|Vendido por/i)[0]; let prices = (priceArea.match(/\\$\\s?[0-9][0-9.,]*/g) || []).map(clean); prices = prices.filter((p, i, arr) => { if (!hasCents(p)) return true; const val = toNum(p); if (!val) return true; return !arr.some((q, j) => { if (i === j) return false; const qv = toNum(q); if (qv <= val * 1.8) return false; const ratio = qv / val; return Math.abs(ratio - Math.round(ratio)) < 0.08 && ratio >= 2 && ratio <= 36; }); }); if (prices.length >= 2) return prices[prices.length - 1]; if (prices.length === 1) return prices[0]; return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "precio_original",
            "selector": "(() => { const txt = ROW.innerText.replace(/\\s+/g,' ').trim(); const clean = s => (s || '').replace(/\\s+/g,'').trim(); const toNum = p => Number(clean(p).replace(/[$,]/g,'')); const hasCents = p => /\\.\\d{2}$/.test(clean(p)); const afterLoan = (txt.match(/semanas\\s+(.+)/i) || [null, txt])[1]; const priceArea = afterLoan.split(/Agregar|Envío|Vendido por/i)[0]; let prices = (priceArea.match(/\\$\\s?[0-9][0-9.,]*/g) || []).map(clean); prices = prices.filter((p, i, arr) => { if (!hasCents(p)) return true; const val = toNum(p); if (!val) return true; return !arr.some((q, j) => { if (i === j) return false; const qv = toNum(q); if (qv <= val * 1.8) return false; const ratio = qv / val; return Math.abs(ratio - Math.round(ratio)) < 0.08 && ratio >= 2 && ratio <= 36; }); }); if (prices.length >= 2) return prices[0]; return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "prestamo",
            "selector": "(() => { const txt = ROW.innerText.replace(/\\s+/g,' '); const m = txt.match(/(Desde\\s*\\$\\s?[0-9][0-9.,]*\\s*a\\s*\\d+\\s*semanas|\\$\\s?[0-9][0-9.,]*\\s*semanales\\s*con)/i); return m ? m[1].replace(/\\s+/g,' ').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "imagen_url",
            "selector": "(() => { const img = ROW.querySelector('img'); if (!img) return ''; return img.currentSrc || img.getAttribute('src') || img.getAttribute('data-src') || (img.getAttribute('srcset') || '').split(' ')[0] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "producto_url",
            "selector": "(() => ROW.href || ROW.getAttribute('href') || '')()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 3000,
      "position_y": 860,
      "config": {}
    }
  ],
  "connections": [
    {
      "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": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-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": "scroll-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "scroll-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": "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": "click-1",
      "from_connector_id": "right",
      "to_block_id": "sleep-3",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-3",
      "from_connector_id": "right",
      "to_block_id": "scroll-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 76,
      "width": 3560,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "sleep-2",
          "sleep-3"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 768,
      "position_y": 76,
      "width": 1400,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1",
          "scroll-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 2568,
      "position_y": 76,
      "width": 680,
      "height": 976,
      "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": 756,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Extracts Elektra México listing product data equivalent to the Octoparse Elektra Listing Scraper: title, current price, original price, weekly loan/payment text, image URL, and product URL. The workflow navigates the supplied Elektra listing/category URLs, attempts to dismiss location prompts, scrolls and clicks VTEX 'Mostrar más / Ver más / Cargar más' buttons until no more are found, then appends all products into one CSV. Price parsing removes decimal MSI installment amounts such as product-price divided by 3, 6, 12, or 24 before exporting the actual product prices. If CAPTCHA appears, manual solving may be required.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => { const candidates = Array.from(document.querySelectorAll('button, [role=\"button\"], a')); con...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1040,
      "position_y": 160,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `//button[not(@disabled) and (contains(normalize-space(.), 'Mostrar más') or contains(normalize-space(.), 'Ver más') or c`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2840,
      "position_y": 160,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Uses XPath `//button[not(@disabled) and (contains(normalize-space(.), 'Mostrar más') or contains(normalize-space`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 3200,
      "position_y": 480,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (titulo, precio, precio_original, prestamo, imagen_url). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2840,
      "position_y": 840,
      "width": 340,
      "height": 131,
      "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": 3200,
      "position_y": 840,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}