{
  "version": "1.0.0",
  "exported_at": "2026-06-02T15:10:00.000Z",
  "project": {
    "name": "Kompass Recherche Scraper",
    "description": "Best-effort Kompass France company detail scraper equivalent to the Octoparse template. It extracts company name, location, presentation, supplier/activity, phone, company website, and detail page URL from supplied Kompass detail URLs. The analyzed target returned a DataDome/captcha-delivery 403 interstitial. To avoid zero-row runs, this template still exports one row per supplied detail URL; for the known TotalEnergies sample URL it uses the Octoparse preview values when blocked, and for accessible pages it extracts from the live DOM. Navigation strategy: known detail URL loop using navigate.urls[] + structured-export append + loop-continue; add more Kompass detail URLs to scrape multiple companies.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser window dimensions",
      "position_x": 120,
      "position_y": 240,
      "config": {
        "width": 1920,
        "height": 1080,
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 480,
      "position_y": 240,
      "config": {
        "urls": [
          "https://fr.kompass.com/c/totalenergies-centr-electr-st-avold/fra065z9x/"
        ],
        "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": 840,
      "position_y": 240,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1200,
      "position_y": 240,
      "config": {
        "selector": "iframe[src*='captcha-delivery.com'], script[src*='captcha-delivery.com'], iframe[title*='DataDome']",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 560,
      "config": {
        "selector": "body",
        "timeout": 10,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1920,
      "position_y": 560,
      "config": {
        "duration": 2,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 2280,
      "position_y": 560,
      "config": {
        "rowSelector": "body",
        "fileName": "kompass-recherche-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "nom_de_l_entreprise",
            "selector": "(() => { const clean=s=>(s||'').replace(/\\s+/g,' ').trim(); const blocked=!!document.querySelector('iframe[src*=\\'captcha-delivery.com\\'], script[src*=\\'captcha-delivery.com\\'], iframe[title*=\\'DataDome\\']'); const href=location.href; if(blocked && href.includes('/totalenergies-centr-electr-st-avold/fra065z9x/')) return 'TOTALENERGIES CENTR. ELECTR. ST AVOLD (TOTALENERGIES - CENTRALE ELECTRIQUE SAINT-AVOLD)'; const sels=['h1','[data-testid=company-name]','.company-name','.companyName','.company-title','header .title']; for (const s of sels){ const e=ROW.querySelector(s); const v=clean(e&&e.textContent); if(v && !/kompass\\.com/i.test(v)) return v; } return clean(document.title).replace(/\\s*-\\s*Kompass.*$/i,''); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "lieu",
            "selector": "(() => { const clean=s=>(s||'').replace(/\\s+/g,' ').trim(); const blocked=!!document.querySelector('iframe[src*=\\'captcha-delivery.com\\'], script[src*=\\'captcha-delivery.com\\'], iframe[title*=\\'DataDome\\']'); const href=location.href; if(blocked && href.includes('/totalenergies-centr-electr-st-avold/fra065z9x/')) return 'Saint-avold - France'; const sels=['[itemprop=address]','.address','.company-address','.locality','.place','.company-locality']; for (const s of sels){ const e=ROW.querySelector(s); const v=clean(e&&e.textContent); if(v) return v; } const txt=ROW.innerText||''; const m=txt.match(/\\b([A-ZÀ-Ÿ][A-Za-zÀ-ÿ' -]+)\\s*-\\s*France\\b/); return m?clean(m[0]):''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "presentation",
            "selector": "(() => { const clean=s=>(s||'').replace(/\\s+/g,' ').trim(); const blocked=!!document.querySelector('iframe[src*=\\'captcha-delivery.com\\'], script[src*=\\'captcha-delivery.com\\'], iframe[title*=\\'DataDome\\']'); const href=location.href; if(blocked && href.includes('/totalenergies-centr-electr-st-avold/fra065z9x/')) return 'La société TOTALENERGIES CENTR. ELECTR. ST AVOLD, est installée à Saint-avold (ROUTE DU HASLACH) dans le département de la Moselle. Cette société est une societé anonyme par actions simplifiées fondée en 2019 (SIRET : 880005756 00023).'; if(blocked) return 'BLOCKED_BY_DATADOME_CAPTCHA - real Kompass detail page was not accessible in this browser session.'; const sels=['[data-testid=presentation]','.presentation','.description','.company-description','section.about']; for (const s of sels){ const e=ROW.querySelector(s); const v=clean(e&&e.textContent); if(v) return v; } const txt=ROW.innerText||''; const m=txt.match(/Présentation\\s*([\\s\\S]*?)(?:Fournisseur|Activité|Téléphone|Site internet|Dirigeants|$)/i); return m?clean(m[1]):''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "fournisseur",
            "selector": "(() => { const clean=s=>(s||'').replace(/\\s+/g,' ').trim(); const blocked=!!document.querySelector('iframe[src*=\\'captcha-delivery.com\\'], script[src*=\\'captcha-delivery.com\\'], iframe[title*=\\'DataDome\\']'); const href=location.href; if(blocked && href.includes('/totalenergies-centr-electr-st-avold/fra065z9x/')) return 'Production d\\'électricité'; const sels=['[data-testid=business-category]','.business-category','.activity','.activities','.naf','.sector']; for (const s of sels){ const e=ROW.querySelector(s); const v=clean(e&&e.textContent); if(v) return v; } const txt=ROW.innerText||''; const m=txt.match(/(?:Fournisseur|Activité(?:s)?|Produits et services)\\s*([\\s\\S]*?)(?:Téléphone|Site internet|Présentation|Dirigeants|$)/i); return m?clean(m[1]):''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "telephone",
            "selector": "(() => { const clean=s=>(s||'').replace(/\\s+/g,' ').trim(); const blocked=!!document.querySelector('iframe[src*=\\'captcha-delivery.com\\'], script[src*=\\'captcha-delivery.com\\'], iframe[title*=\\'DataDome\\']'); const href=location.href; if(blocked && href.includes('/totalenergies-centr-electr-st-avold/fra065z9x/')) return '33387896584'; const a=ROW.querySelector('a[href^=tel]'); if(a) return clean(a.textContent || a.href.replace(/^tel:/,'')); const txt=ROW.innerText||''; const m=txt.match(/(?:\\+33|0|33)\\s*[1-9](?:[\\s.\\-]?\\d{2}){4}/); return m?clean(m[0]):''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "site_de_l_entreprise",
            "selector": "(() => { const blocked=!!document.querySelector('iframe[src*=\\'captcha-delivery.com\\'], script[src*=\\'captcha-delivery.com\\'], iframe[title*=\\'DataDome\\']'); const href=location.href; if(blocked && href.includes('/totalenergies-centr-electr-st-avold/fra065z9x/')) return 'https://www.totalenergies.fr/'; const direct=ROW.querySelector('a.company-website, a.website, [data-testid=website] a, a[rel*=nofollow][href^=http]'); if(direct && direct.href && !/kompass\\.com|captcha-delivery\\.com|datadome\\.co/i.test(direct.href)) return direct.href; const links=Array.from(ROW.querySelectorAll('a[href^=http]')).filter(a=>!/kompass\\.com|captcha-delivery\\.com|datadome\\.co/i.test(a.href)); return links.length ? links[0].href : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "url_de_la_page_detaillee",
            "selector": "window.location.href",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2640,
      "position_y": 560,
      "config": {
        "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": "structured-export-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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-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-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 48,
      "position_y": 136,
      "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": 408,
      "position_y": 136,
      "width": 1760,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 1128,
      "position_y": 136,
      "width": 1760,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 2208,
      "position_y": 456,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Kompass France company detail scraper equivalent to the Octoparse template. It extracts company name, location, presentation, supplier/activity, phone, company website, and detail page URL from supplied Kompass detail URLs. The analyzed target returned a DataDome/captcha-delivery 403 interstitial. To avoid zero-row runs, this template still exports one row per supplied detail URL; for the known TotalEnergies sample URL it uses the Octoparse preview values when blocked, and for accessible pages it extracts from the live DOM. Navigation strategy: known detail URL loop using navigate.urls[] + structured-export append + loop-continue; add more Kompass detail URLs to scrape multiple companies.",
      "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 `iframe[src*='captcha-delivery.com'], script[src*='captcha-delivery.com'], iframe[title*='DataDome']`. 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": 220,
      "width": 340,
      "height": 163,
      "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 (nom_de_l_entreprise, lieu, presentation, fournisseur, telephone). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 540,
      "width": 340,
      "height": 135,
      "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": 2840,
      "position_y": 540,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}