{
  "version": "1.0.0",
  "exported_at": "2026-06-03T18:45:00.000Z",
  "project": {
    "name": "Annuaire 118000 Data Scraper",
    "description": "Extracts Annuaire 118000 listing data from the target listing URL, including nom, adresse, CP, téléphone, and remarque. Pagination is handled automatically by following the page's link[rel=\"next\"] URL until no next page remains. Phone extraction uses visible text/tel links and best-effort decoding for image-rendered numbers. CAPTCHA or anti-bot challenges may require manual solving.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 100,
      "position_y": 220,
      "config": {
        "url": "https://annuaire.118000.fr/v_lille_59/n_lefebvre",
        "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": 460,
      "position_y": 220,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 820,
      "position_y": 220,
      "config": {
        "selector": "section.card.part",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1180,
      "position_y": 220,
      "config": {
        "rowSelector": "section.card.part",
        "fileName": "annuaire_118000_data_scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "nom",
            "selector": "(() => { const el = ROW.querySelector('.name a, .name'); return el ? (el.textContent || '').replace(/\\s+/g, ' ').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "adresse",
            "selector": "(() => { const el = ROW.querySelector('.address'); return el ? (el.innerText || el.textContent || '').replace(/\\s+/g, ' ').trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "cp",
            "selector": "(() => { const el = ROW.querySelector('.address'); const txt = el ? (el.textContent || '').replace(/\\s+/g, ' ').trim() : ''; const m = txt.match(/[0-9]{5}/); return m ? m[0] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "telephone",
            "selector": "(() => { const a = ROW.querySelector('.phone a.atel'); if (!a) return ''; const txt = (a.textContent || '').replace(/\\s+/g, ' ').trim(); if (txt) return txt; const href = a.getAttribute('href') || ''; if (href.startsWith('tel:')) return href.replace(/^tel:/, '').replace(/(\\d{2})(?=\\d)/g, '$1 ').trim(); const img = a.querySelector('img[src*=\"/imagettftext/\"]'); if (img) { const marker = '/imagettftext/'; const idx = img.src.indexOf(marker); if (idx >= 0) { const s = img.src.slice(idx + marker.length).split('/')[0]; for (const c of [s, s.slice(1), s.slice(0, -1), s.slice(1, -1)]) { try { const decoded = atob(c).replace(/[^\\d\\s+]/g, '').replace(/\\s+/g, ' ').trim(); if ((decoded.match(/\\d/g) || []).length >= 8) return decoded; } catch (e) {} } } return img.getAttribute('alt') || ''; } return ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "remarque",
            "selector": ".bubble strong",
            "attribute": "text"
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1540,
      "position_y": 220,
      "config": {
        "selector": "link[rel=\"next\"]"
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 1900,
      "position_y": 420,
      "config": {
        "jsCode": "const next = document.querySelector('link[rel=\"next\"]'); if (next && next.href) { window.location.href = next.href; }",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 2260,
      "position_y": 980,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1900,
      "position_y": 620,
      "config": {
        "selector": "section.card.part",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1540,
      "position_y": 760,
      "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": "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": "true",
      "to_block_id": "inject-javascript-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": "inject-javascript-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": "structured-export-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 28,
      "position_y": 116,
      "width": 2480,
      "height": 1056,
      "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"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1108,
      "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": 1468,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1828,
      "position_y": 316,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 1468,
      "position_y": 656,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Extracts Annuaire 118000 listing data from the target listing URL, including nom, adresse, CP, téléphone, and remarque. Pagination is handled automatically by following the page's link[rel=\"next\"] URL until no next page remains. Phone extraction uses visible text/tel links and best-effort decoding for image-rendered numbers. CAPTCHA or anti-bot challenges may require manual solving.",
      "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 (nom, adresse, cp, telephone). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1380,
      "position_y": 200,
      "width": 340,
      "height": 123,
      "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 `link[rel=\"next\"]`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 1740,
      "position_y": 200,
      "width": 340,
      "height": 135,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `const next = document.querySelector('link[rel=\"next\"]'); if (next && next.href) { window.location.hr...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 2100,
      "position_y": 400,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    }
  ]
}