{
  "version": "1.0.0",
  "exported_at": "2026-06-02T20:35:00.000Z",
  "project": {
    "name": "Administration Data Scraper",
    "description": "Extracts public administration directory details from lannuaire.service-public.gouv.fr: administration name, opening hours, location, website, phone, fax, and detail URL. Navigation uses a pre-enumerated multi-URL loop of Service-Public detail pages matching the Octoparse preview; add more detail URLs to navigate.urls to scrape additional keyword results.",
    "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": 260,
      "config": {
        "urls": [
          "https://lannuaire.service-public.gouv.fr/ile-de-france/paris/15d64883-4dc8-4ce8-bea3-ed9b5b37f46f",
          "https://lannuaire.service-public.gouv.fr/occitanie/haute-garonne/f58cc559-cc0e-46c2-9b52-1af8c0d479e4",
          "https://lannuaire.service-public.gouv.fr/ile-de-france/paris/46c3d89c-1782-480a-846a-e87e74238265",
          "https://lannuaire.service-public.gouv.fr/occitanie/haute-garonne/4621b445-4bcb-4769-8494-a4eed9918649",
          "https://lannuaire.service-public.gouv.fr/ile-de-france/paris/6de66144-10e4-4c3e-8d54-059dfa0ca087",
          "https://lannuaire.service-public.gouv.fr/ile-de-france/paris/f730a9f2-af30-4650-a30c-7babd583e13d",
          "https://lannuaire.service-public.gouv.fr/bourgogne-franche-comte/jura/bb402437-341d-48bc-855d-8ed7644e4493"
        ],
        "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
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 840,
      "position_y": 260,
      "config": {
        "selector": "article.article",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1200,
      "position_y": 260,
      "config": {
        "rowSelector": "article.article",
        "fileName": "lannuaire-service-public-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "administration",
            "selector": "(ROW.querySelector('h1#titlePage, h1')?.textContent || '').trim()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "horaires",
            "selector": "(() => { const heading = Array.from(ROW.querySelectorAll('h2')).find(h => /Horaires/i.test(h.textContent || '')); if (!heading) return ''; const parts = []; for (let el = heading.nextElementSibling; el && el.tagName !== 'H2'; el = el.nextElementSibling) { const txt = (el.innerText || el.textContent || '').trim(); if (txt) parts.push(txt); } return parts.join('\\n').replace(/[ \\t]+/g, ' ').trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "lieu",
            "selector": "(() => { const addr = ROW.querySelector('[data-test=\"adaAddress-bloc\"]'); if (addr) return Array.from(addr.querySelectorAll('[itemprop]')).map(e => e.textContent.trim()).join(' ').replace(/\\s+/g, ' ').trim(); const heading = Array.from(ROW.querySelectorAll('h2')).find(h => /Lieu/i.test(h.textContent || '')); if (!heading) return ''; const parts = []; for (let el = heading.nextElementSibling; el && el.tagName !== 'H2'; el = el.nextElementSibling) { const txt = (el.innerText || el.textContent || '').trim(); if (txt && !/Voir sur une carte/i.test(txt)) parts.push(txt); } return parts.join(' ').replace(/\\s+/g, ' ').trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "site",
            "selector": "(() => { const contacts = ROW.querySelector('[data-test=\"contacts\"]') || ROW; const websiteBlock = contacts.querySelector('[data-test=\"websites\"]') || Array.from(contacts.querySelectorAll('li')).find(li => /Site web/i.test(li.innerText || li.textContent || '')); const a = websiteBlock && websiteBlock.querySelector('a[href^=\"http\"]'); return a ? a.href : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "telephone",
            "selector": "(() => { const contacts = ROW.querySelector('[data-test=\"contacts\"]') || ROW; const direct = contacts.querySelector('[data-test*=\"phone\" i], [data-test*=\"telephone\" i]'); const blocks = direct ? [direct] : Array.from(contacts.querySelectorAll('li')).filter(li => /Téléphone/i.test(li.innerText || li.textContent || '') && !/accessible/i.test(li.innerText || li.textContent || '')); return blocks.map(li => (li.innerText || li.textContent || '').replace(/^\\s*Téléphone\\s*/i, '').trim()).filter(Boolean).join('\\n'); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "fax",
            "selector": "(() => { const contacts = ROW.querySelector('[data-test=\"contacts\"]') || ROW; const direct = contacts.querySelector('[data-test*=\"fax\" i]'); const blocks = direct ? [direct] : Array.from(contacts.querySelectorAll('li')).filter(li => /Fax/i.test(li.innerText || li.textContent || '')); return blocks.map(li => (li.innerText || li.textContent || '').replace(/^\\s*Fax\\s*/i, '').trim()).filter(Boolean).join('\\n'); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "url_de_la_page_detaillee",
            "selector": "window.location.href",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1560,
      "position_y": 260,
      "config": {
        "duration": 1
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 1920,
      "position_y": 260,
      "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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-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": 156,
      "width": 1760,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1128,
      "position_y": 156,
      "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": 1848,
      "position_y": 156,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Extracts public administration directory details from lannuaire.service-public.gouv.fr: administration name, opening hours, location, website, phone, fax, and detail URL. Navigation uses a pre-enumerated multi-URL loop of Service-Public detail pages matching the Octoparse preview; add more detail URLs to navigate.urls to scrape additional keyword results.",
      "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 7 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 320,
      "position_y": 240,
      "width": 328,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (administration, horaires, lieu, site, telephone). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1400,
      "position_y": 240,
      "width": 340,
      "height": 129,
      "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": 2120,
      "position_y": 240,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}