{
  "version": "1.0.0",
  "exported_at": "2026-06-02T13:00:00.000Z",
  "project": {
    "name": "Idealista Real Estate Listing Scraper Italy",
    "description": "Scrapes Idealista.it Italian real estate listing result pages and exports URL, sale/rent type, category, locality, title, detail URL, price, listing details, description, and image URL. Pagination is handled with a click-next loop so all result pages are appended into one CSV. Note: Idealista may show DataDome/CAPTCHA protection; if listing rows are not available, the template ends cleanly and may require manual challenge resolution or a trusted browser/proxy session.",
    "color": "bg-[#42be65]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 120,
      "position_y": 260,
      "config": {
        "url": "https://www.idealista.it/affitto-case/verona-verona/",
        "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": 260,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 840,
      "position_y": 260,
      "config": {
        "duration": 3,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1200,
      "position_y": 260,
      "config": {
        "selector": "article.item[data-element-id], article.item",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "end-2",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1200,
      "position_y": 620,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 260,
      "config": {
        "selector": "article.item[data-element-id], article.item",
        "timeout": 20,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1920,
      "position_y": 260,
      "config": {
        "rowSelector": "article.item[data-element-id], article.item",
        "fileName": "crawler-lista-immobili-idealista.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "url",
            "selector": "window.location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "vendita_o_affitto",
            "selector": "(() => { const p = window.location.pathname.toLowerCase(); if (p.includes('affitto')) return 'Affitto'; if (p.includes('vendita')) return 'Vendita'; return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "categoria",
            "selector": "(() => { const p = window.location.pathname.toLowerCase(); if (p.includes('case')) return 'Case e appartamenti'; if (p.includes('garage')) return 'Garage e posti auto'; if (p.includes('terreni')) return 'Terreni'; if (p.includes('uffici') || p.includes('locali')) return 'Uffici e locali'; return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "localita",
            "selector": "(() => { const parts = window.location.pathname.split('/').filter(Boolean); let slug = parts[1] || ''; let words = slug.split('-').filter(Boolean); if (words.length % 2 === 0) { const mid = words.length / 2; if (words.slice(0, mid).join('-') === words.slice(mid).join('-')) words = words.slice(0, mid); } return words.join(' ').replace(/\\b\\w/g, c => c.toUpperCase()).trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "titolo_appartamento",
            "selector": ".item-info-container a.item-link, a.item-link",
            "attribute": "text"
          },
          {
            "name": "dettagli_appartamento_url",
            "selector": ".item-info-container a.item-link, a.item-link",
            "attribute": "href"
          },
          {
            "name": "prezzo",
            "selector": ".item-price",
            "attribute": "text"
          },
          {
            "name": "dettagli_1",
            "selector": "(() => { const d = Array.from(ROW.querySelectorAll('.item-detail-char .item-detail, .item-detail')).map(e => e.textContent.trim()).filter(Boolean); return d[0] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "dettagli_2",
            "selector": "(() => { const d = Array.from(ROW.querySelectorAll('.item-detail-char .item-detail, .item-detail')).map(e => e.textContent.trim()).filter(Boolean); return d[1] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "dettagli_3",
            "selector": "(() => { const d = Array.from(ROW.querySelectorAll('.item-detail-char .item-detail, .item-detail')).map(e => e.textContent.trim()).filter(Boolean); return d[2] || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "dettagli_4",
            "selector": "(() => { const d = Array.from(ROW.querySelectorAll('.item-detail-char .item-detail, .item-detail')).map(e => e.textContent.trim()).filter(Boolean); return d[3] || ROW.querySelector('.item-date, .txt-highlight-red')?.textContent.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "descrizione",
            "selector": ".item-description, .item-description p",
            "attribute": "text"
          },
          {
            "name": "immagine_url",
            "selector": "(() => { const img = ROW.querySelector('img'); const raw = img?.getAttribute('src') || img?.getAttribute('data-src') || ROW.querySelector('source[srcset]')?.getAttribute('srcset')?.split(',')[0]?.trim().split(' ')[0] || ''; return raw ? new URL(raw, window.location.href).href : ''; })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-2",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 2280,
      "position_y": 260,
      "config": {
        "selector": "nav.pagination li.next a, .pagination li.next a, a[title=\"Successivo\"], a[aria-label*=\"Successivo\"]",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 2280,
      "position_y": 620,
      "config": {
        "color": "bg-[#8d8d8d]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2640,
      "position_y": 260,
      "config": {
        "selector": "nav.pagination li.next a, .pagination li.next a, a[title=\"Successivo\"], a[aria-label*=\"Successivo\"]",
        "timeout": 10,
        "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": 3000,
      "position_y": 260,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3360,
      "position_y": 620,
      "config": {
        "duration": 2,
        "color": "bg-[#ff832b]"
      }
    }
  ],
  "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": "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"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "true",
      "to_block_id": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "end-2",
      "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-1",
      "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-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-2",
      "from_connector_id": "right",
      "to_block_id": "element-exists-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 156,
      "width": 3560,
      "height": 656,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "sleep-2"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1128,
      "position_y": 156,
      "width": 1760,
      "height": 296,
      "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": 1128,
      "position_y": 516,
      "width": 1400,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-2",
          "end-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1848,
      "position_y": 156,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Idealista.it Italian real estate listing result pages and exports URL, sale/rent type, category, locality, title, detail URL, price, listing details, description, and image URL. Pagination is handled with a click-next loop so all result pages are appended into one CSV. Note: Idealista may show DataDome/CAPTCHA protection; if listing rows are not available, the template ends cleanly and may require manual challenge resolution or a trusted browser/proxy session.",
      "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 `article.item[data-element-id], article.item`. 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": 240,
      "width": 340,
      "height": 144,
      "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 (url, vendita_o_affitto, categoria, localita, dettagli_1). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 240,
      "width": 340,
      "height": 132,
      "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 `nav.pagination li.next a, .pagination li.next a, a[title=\"Successivo\"], a[aria-label*=\"Successivo\"]`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 240,
      "width": 340,
      "height": 163,
      "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": 240,
      "width": 316,
      "height": 106,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}