{
  "version": "1.0.0",
  "exported_at": "2026-06-02T01:05:00.000Z",
  "project": {
    "name": "Amazon Product Listing Scraper for Italy",
    "description": "Scrapes Amazon.it search result listings for the keyword 'baby monitor', exporting product title, sponsored flag, product URL, ASIN, rating, review count, review URL, prices, image URL, site, postal code, keyword, and page number. Pagination is handled by clicking Amazon's enabled Next button until no further result page exists. If Amazon shows a CAPTCHA / automated-access page, the template stops safely; scraping Amazon may require a trusted browser profile, residential proxy, or manual CAPTCHA resolution.",
    "color": "bg-[#ff9900]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser viewport size",
      "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": 456,
      "position_y": 220,
      "config": {
        "url": "https://www.amazon.it/s?k=baby+monitor&page=1",
        "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": 792,
      "position_y": 220,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1128,
      "position_y": 220,
      "config": {
        "selector": "form[action*='/errors/validateCaptcha'], input[name='amzn-r']",
        "color": "bg-[#da1e28]"
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1464,
      "position_y": 520,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1128,
      "position_y": 520,
      "config": {
        "selector": "div[data-component-type=\"s-search-result\"][data-asin]:not([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": 1632,
      "position_y": 800,
      "config": {
        "rowSelector": "div[data-component-type=\"s-search-result\"][data-asin]:not([data-asin=\"\"])",
        "fileName": "crawler_elenchi_prodotti_amazon.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "sito",
            "selector": "(() => 'Amazon.it')()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "codice_postale",
            "selector": "(() => '16129')()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "parola_chiave",
            "selector": "(() => { const k = new URLSearchParams(location.search).get('k'); return k ? k.replace(/\\+/g, ' ') : 'baby monitor'; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "pagina_attuale",
            "selector": "(() => { const p = new URLSearchParams(location.search).get('page'); const selected = document.querySelector('.s-pagination-selected'); return p || (selected ? selected.textContent.trim() : '1'); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "titolo_prodotto",
            "selector": "(() => { const el = ROW.querySelector('h2 span, [data-cy=\"title-recipe\"] span'); return el ? el.textContent.trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "sponsorizzato",
            "selector": "(() => { return (/Sponsorizzato|Sponsored/i.test(ROW.textContent) || !!ROW.querySelector('.puis-sponsored-label-text')) ? 'true' : 'false'; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_page",
            "selector": "(() => { const a = ROW.querySelector('a[href*=\"/dp/\"], a[href*=\"/gp/product/\"]'); return a ? new URL(a.getAttribute('href'), location.origin).href : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "asin",
            "selector": "ROW.getAttribute('data-asin') || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "valutazione",
            "selector": "(() => { const el = Array.from(ROW.querySelectorAll('.a-icon-alt')).find(x => /stelle|stars|su 5|out of 5/i.test(x.textContent)); return el ? el.textContent.trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "quantita_valutazioni",
            "selector": "(() => { const a = Array.from(ROW.querySelectorAll('a[href*=\"customerReviews\"]')).find(x => /\\d/.test(x.textContent)); return a ? a.textContent.replace(/[()]/g, '').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "pagina_recensioni_url",
            "selector": "(() => { const a = ROW.querySelector('a[href*=\"/dp/\"], a[href*=\"/gp/product/\"]'); if (!a) return ''; const u = new URL(a.getAttribute('href'), location.origin).href.split('#')[0]; return u + '#customerReviews'; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "prezzo_attuale",
            "selector": ".a-price:not(.a-text-price) .a-offscreen",
            "attribute": "text"
          },
          {
            "name": "prezzo_consigliato",
            "selector": ".a-price.a-text-price .a-offscreen",
            "attribute": "text"
          },
          {
            "name": "imagine_url",
            "selector": "img.s-image",
            "attribute": "src"
          }
        ]
      }
    },
    {
      "block_id": "element-exists-2",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1968,
      "position_y": 800,
      "config": {
        "selector": "a.s-pagination-next:not(.s-pagination-disabled)",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "end-2",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 2304,
      "position_y": 800,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2640,
      "position_y": 800,
      "config": {
        "selector": "a.s-pagination-next:not(.s-pagination-disabled)",
        "timeout": 15,
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 2976,
      "position_y": 800,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3312,
      "position_y": 800,
      "config": {
        "duration": 2,
        "color": "bg-[#8d8d8d]"
      }
    }
  ],
  "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": "end-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "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-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-2",
      "from_connector_id": "false",
      "to_block_id": "end-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-2",
      "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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-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": 384,
      "position_y": 116,
      "width": 3176,
      "height": 876,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1056,
      "position_y": 116,
      "width": 1832,
      "height": 876,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "element-exists-2",
          "click-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 1392,
      "position_y": 416,
      "width": 1160,
      "height": 576,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1",
          "end-2"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1560,
      "position_y": 696,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Amazon.it search result listings for the keyword 'baby monitor', exporting product title, sponsored flag, product URL, ASIN, rating, review count, review URL, prices, image URL, site, postal code, keyword, and page number. Pagination is handled by clicking Amazon's enabled Next button until no further result page exists. If Amazon shows a CAPTCHA / automated-access page, the template stops safely; scraping Amazon may require a trusted browser profile, residential proxy, or manual CAPTCHA resolution.",
      "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 `form[action*='/errors/validateCaptcha'], input[name='amzn-r']`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1328,
      "position_y": 200,
      "width": 340,
      "height": 150,
      "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 (sito, codice_postale, parola_chiave, pagina_attuale, titolo_prodotto). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1832,
      "position_y": 780,
      "width": 340,
      "height": 136,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-element-exists-2",
      "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": 2168,
      "position_y": 780,
      "width": 340,
      "height": 146,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-2"
      }
    },
    {
      "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": 2840,
      "position_y": 780,
      "width": 316,
      "height": 106,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}