{
  "version": "1.0.0",
  "exported_at": "2026-05-31T00:00:00.000Z",
  "project": {
    "name": "Amazon Scraper",
    "description": "Best-effort Amazon.com search-results scraper equivalent to the Octoparse Amazon Scraper catalog entry. Extracts product title, price, rating, ASIN, product URL, review/comment count, image URL, inventory/delivery text, and Prime/badge data from Amazon listing pages. Uses click-based pagination: after each page is exported, the workflow checks for an enabled Next button and loops until no further page is available. Starting URL is https://www.amazon.com/s?k=laptop and can be changed to another Amazon search URL. Amazon may block automation with CAPTCHA, bot detection, regional prompts, or changing page markup. Product URL includes a fallback built from ASIN when the listing anchor is unavailable.",
    "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": 100,
      "position_y": 180,
      "config": {
        "width": 1920,
        "height": 1080,
        "color": "bg-[#4589ff]",
        "tags": [
          "setup",
          "amazon"
        ]
      }
    },
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 460,
      "position_y": 180,
      "config": {
        "url": "https://www.amazon.com/s?k=laptop",
        "color": "bg-[#4589ff]",
        "tags": [
          "amazon",
          "search-results"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 820,
      "position_y": 180,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1180,
      "position_y": 180,
      "config": {
        "selector": "div.s-main-slot div[data-component-type=\"s-search-result\"][data-asin]",
        "timeout": 30,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1540,
      "position_y": 180,
      "config": {
        "rowSelector": "div.s-main-slot div[data-component-type=\"s-search-result\"][data-asin]",
        "fileName": "amazon_scraper_refined.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "tags": [
          "amazon",
          "products",
          "csv"
        ],
        "columns": [
          {
            "name": "asin",
            "selector": "ROW.getAttribute('data-asin') || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "title",
            "selector": "(() => { const selectors = ['h2 span', '[data-cy=\"title-recipe\"] h2 span', 'a[href*=\"/dp/\"] span', 'a[href*=\"/gp/product/\"] span', 'span.a-size-medium.a-color-base.a-text-normal', 'span.a-size-base-plus.a-color-base.a-text-normal']; for (const sel of selectors) { const el = ROW.querySelector(sel); const txt = (el?.innerText || el?.textContent || '').replace(/\\s+/g, ' ').trim(); if (txt) return txt; } return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(() => { const offscreen = ROW.querySelector('.a-price .a-offscreen'); if (offscreen && offscreen.textContent.trim()) return offscreen.textContent.trim(); const whole = ROW.querySelector('.a-price-whole')?.textContent?.trim() || ''; const fraction = ROW.querySelector('.a-price-fraction')?.textContent?.trim() || ''; return whole ? (fraction ? `${whole}${fraction}` : whole) : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating",
            "selector": "(() => { const nodes = Array.from(ROW.querySelectorAll('[aria-label*=\"out of 5 stars\"], '.concat('.a-icon-alt, i[class*=\"a-icon-star\"] span'))); const values = nodes.map(e => e.getAttribute('aria-label') || e.innerText || e.textContent || '').map(t => t.replace(/\\s+/g, ' ').trim()).filter(Boolean); const found = values.find(t => /out of\\s+5\\s+stars/i.test(t)); return found || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_comment_count",
            "selector": "(() => { const selectors = ['a[href*=\"customerReviews\"]', 'a[href*=\"#customerReviews\"]', 'a[aria-label*=\"ratings\"]', 'span[aria-label*=\"ratings\"]', 'span.a-size-base.s-underline-text']; const values = []; for (const sel of selectors) { for (const el of ROW.querySelectorAll(sel)) { const raw = (el.getAttribute('aria-label') || el.innerText || el.textContent || '').replace(/\\s+/g, ' ').trim(); if (raw && !/out of\\s+5\\s+stars/i.test(raw)) values.push(raw); } } const numeric = values.map(v => { const m = v.match(/[0-9][0-9,]*/); return m ? m[0] : ''; }).find(Boolean); return numeric || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_url",
            "selector": "(() => { const asin = ROW.getAttribute('data-asin') || ''; const links = Array.from(ROW.querySelectorAll('a[href]')); const link = links.find(a => /\\/(dp|gp\\/product)\\//.test(a.getAttribute('href') || a.href || '')) || links.find(a => asin && (a.getAttribute('href') || a.href || '').includes(asin)); if (link) { try { const u = new URL(link.getAttribute('href') || link.href, location.origin); u.search = ''; u.hash = ''; return u.href; } catch (e) { return link.href || ''; } } return asin ? `https://www.amazon.com/dp/${asin}` : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "image_url",
            "selector": "img.s-image",
            "attribute": "src"
          },
          {
            "name": "inventory_delivery",
            "selector": "(() => { const selectors = ['[data-cy=\"delivery-recipe\"]', '[data-cy=\"delivery-block\"]', '.a-row.a-size-base.a-color-secondary', '.a-color-base.a-text-bold']; const texts = []; for (const sel of selectors) { for (const el of ROW.querySelectorAll(sel)) { const txt = (el.innerText || el.textContent || '').replace(/\\s+/g, ' ').trim(); if (txt && !texts.includes(txt)) texts.push(txt); } } return texts.join(' | '); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "prime_or_badge",
            "selector": "(() => { const values = []; if (ROW.querySelector('.a-icon-prime')) values.push('Prime'); for (const el of ROW.querySelectorAll('.a-badge-text, .puis-label-popover-default span, [aria-label*=\"Amazon Prime\"]')) { const txt = (el.getAttribute('aria-label') || el.innerText || el.textContent || '').replace(/\\s+/g, ' ').trim(); if (txt && !values.includes(txt)) values.push(txt); } return values.join(' | '); })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1900,
      "position_y": 180,
      "config": {
        "selector": "a.s-pagination-next:not(.s-pagination-disabled)",
        "color": "bg-[#ff832b]",
        "tags": [
          "pagination",
          "next-page"
        ]
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1900,
      "position_y": 540,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2260,
      "position_y": 540,
      "config": {
        "selector": "a.s-pagination-next:not(.s-pagination-disabled)",
        "timeout": 10,
        "color": "bg-[#ff832b]",
        "tags": [
          "pagination",
          "next-page"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 2620,
      "position_y": 540,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 2980,
      "position_y": 540,
      "config": {
        "selector": "div.s-main-slot div[data-component-type=\"s-search-result\"][data-asin]",
        "timeout": 30,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3340,
      "position_y": 540,
      "config": {
        "duration": 2,
        "color": "bg-[#8d8d8d]",
        "tags": [
          "pagination",
          "rate-limit"
        ]
      }
    }
  ],
  "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": "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": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "end-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": "wait-for-page-load-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-page-load-2",
      "from_connector_id": "right",
      "to_block_id": "wait-for-element-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-2",
      "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": "structured-export-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 28,
      "position_y": 76,
      "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": 388,
      "position_y": 76,
      "width": 3200,
      "height": 656,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "wait-for-element-2",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1468,
      "position_y": 76,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1828,
      "position_y": 76,
      "width": 680,
      "height": 656,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 1828,
      "position_y": 436,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Amazon.com search-results scraper equivalent to the Octoparse Amazon Scraper catalog entry. Extracts product title, price, rating, ASIN, product URL, review/comment count, image URL, inventory/delivery text, and Prime/badge data from Amazon listing pages. Uses click-based pagination: after each page is exported, the workflow checks for an enabled Next button and loops until no further page is available. Starting URL is https://www.amazon.com/s?k=laptop and can be changed to another Amazon search URL. Amazon may block automation with CAPTCHA, bot detection, regional prompts, or changing page markup. Product URL includes a fallback built from ASIN when the listing anchor is unavailable.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (asin, title, price, rating, review_comment_count). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1740,
      "position_y": 160,
      "width": 340,
      "height": 130,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `a.s-pagination-next:not(.s-pagination-disabled)`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2100,
      "position_y": 160,
      "width": 340,
      "height": 146,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Pagination click — add waits after this block; the page reloads asynchronously.",
      "color": "#ee5396",
      "position_x": 2460,
      "position_y": 520,
      "width": 316,
      "height": 106,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    },
    {
      "id": "note-amazon-limitations",
      "element_type": "note",
      "title": "Amazon Blocking Risk",
      "content": "Amazon frequently uses CAPTCHA, anti-bot detection, location prompts, and dynamic markup. If rows do not load, open the browser profile manually, solve prompts, set location if needed, or use an appropriate proxy/session strategy. Some products genuinely have no rating/review count, so those cells may be blank.",
      "color": "#da1e28",
      "position_x": 2620,
      "position_y": 735,
      "width": 560,
      "height": 140,
      "z_index": 22,
      "block_id": null,
      "connection_id": null,
      "data": {
        "minimized": false
      }
    }
  ]
}