{
  "version": "1.0.0",
  "exported_at": "2026-06-02T00:00:00.000Z",
  "project": {
    "name": "eBay Product Listing Scraper for Italy",
    "description": "Scrapes eBay.it product listing data by keyword, including keyword, product title, detail URL, condition, price, shipping cost, location, and current scrape time. Uses deterministic paginated search URLs in navigate.urls[] instead of clicking Next, avoiding eBay pagination loops. Starter URLs cover pages 1-5 for caffettiera, powerbank, and tablet; add more _pgn URLs in the Navigate block to extend coverage. Best-effort: eBay may show CAPTCHA, anti-bot checks, or layout changes.",
    "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": 220,
      "config": {
        "urls": [
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=caffettiera&_sacat=0&_pgn=1",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=caffettiera&_sacat=0&_pgn=2",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=caffettiera&_sacat=0&_pgn=3",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=caffettiera&_sacat=0&_pgn=4",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=caffettiera&_sacat=0&_pgn=5",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=powerbank&_sacat=0&_pgn=1",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=powerbank&_sacat=0&_pgn=2",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=powerbank&_sacat=0&_pgn=3",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=powerbank&_sacat=0&_pgn=4",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=powerbank&_sacat=0&_pgn=5",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=tablet&_sacat=0&_pgn=1",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=tablet&_sacat=0&_pgn=2",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=tablet&_sacat=0&_pgn=3",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=tablet&_sacat=0&_pgn=4",
          "https://www.ebay.it/sch/i.html?_from=R40&_nkw=tablet&_sacat=0&_pgn=5"
        ],
        "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": 220,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute JavaScript code",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "jsCode": "(() => {\n  const selectors = [\n    '#gdpr-banner-accept',\n    'button#gdpr-banner-accept',\n    'button[data-testid=\"gdpr-banner-accept\"]',\n    'button[aria-label=\"Accept all\"]',\n    'button[aria-label=\"Accetta tutto\"]',\n    'button[aria-label=\"Accetta\"]'\n  ];\n  for (const selector of selectors) {\n    const el = document.querySelector(selector);\n    if (el) {\n      el.click();\n      return 'cookie banner dismissed: ' + selector;\n    }\n  }\n  const buttons = Array.from(document.querySelectorAll('button, input[type=\"button\"], input[type=\"submit\"]'));\n  const textButton = buttons.find(btn => {\n    const txt = ((btn.innerText || btn.textContent || btn.value || '') + '').trim();\n    return /^(accetta|accetto|accept|agree|ok|continua)/i.test(txt);\n  });\n  if (textButton) {\n    textButton.click();\n    return 'cookie banner dismissed by text';\n  }\n  return 'no cookie banner found';\n})();",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1200,
      "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": 1560,
      "position_y": 220,
      "config": {
        "selector": "a[href*=\"www.ebay.it/itm/\"]",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1920,
      "position_y": 220,
      "config": {
        "rowSelector": "li.s-item:has(a[href*=\"www.ebay.it/itm/\"]), div.s-item__wrapper:has(a[href*=\"www.ebay.it/itm/\"]), div.s-card:has(a[href*=\"www.ebay.it/itm/\"]), div[data-testid=\"item-card\"]:has(a[href*=\"www.ebay.it/itm/\"])",
        "columns": [
          {
            "name": "parola_chiave",
            "selector": "(() => { const u = new URL(window.location.href); return u.searchParams.get('_nkw') || u.searchParams.get('_skw') || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "titolo_prodotto",
            "selector": "(() => {\n  const row = ROW;\n  const clean = s => (s || '').replace(/\\s+/g, ' ').replace(/^NUOVA INSERZIONE\\s*/i, '').replace(/^New Listing\\s*/i, '').trim();\n  const bad = /^(scelti per te|sponsorizzato|annuncio|opens in a new window|shop on ebay)$/i;\n  const selectors = [\n    '.s-item__title span[role=\"heading\"]',\n    '.s-item__title',\n    '.s-card__title',\n    '[data-testid=\"item-title\"]',\n    '[role=\"heading\"]',\n    'h3',\n    'h2'\n  ];\n  for (const sel of selectors) {\n    const el = row.querySelector(sel);\n    const txt = clean(el && (el.innerText || el.textContent));\n    if (txt && !bad.test(txt)) return txt;\n  }\n  const img = row.querySelector('img[alt]');\n  const alt = clean(img && img.getAttribute('alt'));\n  if (alt && !bad.test(alt)) return alt;\n  const link = row.querySelector('a[href*=\"www.ebay.it/itm/\"]');\n  const label = clean(link && (link.getAttribute('aria-label') || link.getAttribute('title') || link.innerText || link.textContent));\n  if (label && !bad.test(label)) return label;\n  const text = clean(row.innerText || row.textContent);\n  const lines = text.split(/\\s{2,}|\\n/).map(clean).filter(Boolean).filter(x => !bad.test(x));\n  return lines.find(x => x.length > 8 && !/^EUR\\s/i.test(x) && !/venditore|consegna|spedizione|^da\\s/i.test(x)) || '';\n})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "url_pagina_dei_dettagli",
            "selector": "(() => { const link = ROW.querySelector('a[href*=\"www.ebay.it/itm/\"]'); return link ? link.href : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "condizione",
            "selector": "(() => {\n  const row = ROW;\n  const clean = s => (s || '').replace(/\\s+/g, ' ').trim();\n  const el = row.querySelector('.SECONDARY_INFO, .s-item__subtitle, .s-card__subtitle, [data-testid=\"item-condition\"], [class*=\"condition\" i]');\n  const txt = clean(el && (el.innerText || el.textContent));\n  if (txt) return txt;\n  const body = clean(row.innerText || row.textContent);\n  const m = body.match(/\\b(Nuovo|Usato|Di seconda mano|Solo ricambi|Ricondizionato|Aperto ma mai usato|Brand New|Used|Pre-owned|For parts)[^\\n,;]*/i);\n  return m ? clean(m[0]) : '';\n})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "prezzo",
            "selector": "(() => {\n  const row = ROW;\n  const clean = s => (s || '').replace(/\\s+/g, ' ').trim();\n  const el = row.querySelector('.s-item__price, .s-card__price, [data-testid=\"x-price-primary\"], [data-testid=\"item-price\"], [class*=\"price\" i]');\n  const txt = clean(el && (el.innerText || el.textContent));\n  if (txt) return txt;\n  const body = clean(row.innerText || row.textContent);\n  const m = body.match(/(?:EUR|€)\\s*[0-9][0-9.,]*(?:\\s*a\\s*(?:EUR|€)?\\s*[0-9][0-9.,]*)?/i);\n  return m ? clean(m[0]) : '';\n})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "costo_di_spedizione",
            "selector": "(() => {\n  const row = ROW;\n  const clean = s => (s || '').replace(/\\s+/g, ' ').trim();\n  const el = row.querySelector('.s-item__shipping, .s-item__logisticsCost, .s-card__shipping, [data-testid=\"item-shipping\"], [class*=\"shipping\" i], [class*=\"logistics\" i]');\n  const txt = clean(el && (el.innerText || el.textContent));\n  if (txt) return txt;\n  const body = clean(row.innerText || row.textContent);\n  const free = body.match(/Consegna gratuita|Spedizione gratuita|Free shipping/i);\n  if (free) return clean(free[0]);\n  const paid = body.match(/\\+\\s*(?:EUR|€)\\s*[0-9][0-9.,]*\\s*(?:per la consegna|spedizione|shipping)?/i);\n  return paid ? clean(paid[0]) : '';\n})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "localita",
            "selector": "(() => {\n  const row = ROW;\n  const clean = s => (s || '').replace(/\\s+/g, ' ').trim();\n  const el = row.querySelector('.s-item__location, .s-card__location, [data-testid=\"item-location\"], [class*=\"location\" i]');\n  const txt = clean(el && (el.innerText || el.textContent));\n  if (txt) return txt;\n  const body = clean(row.innerText || row.textContent);\n  const m = body.match(/\\bda\\s+(Italia|Germania|Spagna|Francia|Stati Uniti|Regno Unito|Repubblica Ceca|Cina|Giappone|[A-ZÀ-Ý][A-Za-zÀ-ÿ' -]{2,40})\\b/i);\n  return m ? clean(m[0]) : '';\n})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "ora_attuale",
            "selector": "new Date().toLocaleString('it-IT', { timeZone: 'Europe/Rome' })",
            "attribute": "text",
            "isJs": true
          }
        ],
        "fileName": "crawler-elenco-prodotti-ebay.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append"
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2280,
      "position_y": 220,
      "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": "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": 116,
      "width": 1760,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 768,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1848,
      "position_y": 116,
      "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": 2208,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes eBay.it product listing data by keyword, including keyword, product title, detail URL, condition, price, shipping cost, location, and current scrape time. Uses deterministic paginated search URLs in navigate.urls[] instead of clicking Next, avoiding eBay pagination loops. Starter URLs cover pages 1-5 for caffettiera, powerbank, and tablet; add more _pgn URLs in the Navigate block to extend coverage. Best-effort: eBay may show CAPTCHA, anti-bot checks, or layout changes.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-navigate-1",
      "element_type": "note",
      "title": "Note: Navigate",
      "content": "Multi-URL loop over 15 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 320,
      "position_y": 200,
      "width": 332,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => {\n  const selectors = [\n    '#gdpr-banner-accept',\n    'button#gdpr-banner-accept',\n    'butt...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1040,
      "position_y": 200,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (parola_chiave, titolo_prodotto, url_pagina_dei_dettagli, condizione, prezzo). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 200,
      "width": 340,
      "height": 139,
      "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": 2480,
      "position_y": 200,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}