{
  "version": "1.0.0",
  "exported_at": "2026-06-02T21:55:00.000Z",
  "project": {
    "name": "Belles Demeures Biens   vendre Scraper",
    "description": "Equivalent UScraper template for the Octoparse Belles Demeures real-estate scraper. It accepts multiple BellesDemeures sale/detail/search URLs, normalizes visible property cards/detail content into internal .uscraper-row records, and exports type, rooms, area, address, price, agency, detail URL, photo URL, description, and phone. Uses a multi-URL loop and conservative search-result pagination. The provided sample detail URLs may redirect to expired/search pages; this template extracts active replacement listing cards when that happens. Initial analysis detected DataDome/HTTP 403, so trusted profile/proxy/manual clearance may be required.",
    "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://www.bellesdemeures.com/annonces/vente/tt-2-tb-1-pl-14455/219886275/#?m=search_to_detail",
          "https://www.bellesdemeures.com/annonces/vente/tt-2-tb-1-pl-48227/204094165/#?m=search_to_detail",
          "https://www.bellesdemeures.com/annonces/vente/tt-2-tb-2-pl-39964/208354971/?idtt=2&pl=73&tri=selection&idstb=28&si_terrasse=1&m=search_to_detail",
          "https://www.bellesdemeures.com/annonces/vente/tt-2-tb-1-pl-39294/220538673/#?m=search_to_detail",
          "https://www.bellesdemeures.com/annonces/vente/tt-2-tb-2-pl-5465/220500237/?idtt=2&pl=73&tri=selection&idstb=28&si_terrasse=1&m=search_to_detail"
        ],
        "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": 45
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 840,
      "position_y": 260,
      "config": {
        "duration": 3
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript on the page",
      "position_x": 1200,
      "position_y": 260,
      "config": {
        "jsCode": "(function(){const clean=v=>v==null?'':String(v).replace(/\\s+/g,' ').trim();const badAgency=v=>!v||/message envoyé|message envoye|budget|valeur min|valeur max|contacter|contactez|téléphone|telephone|voir le numéro|email|cookies|envoyer/i.test(clean(v))||clean(v).length>120;const abs=u=>{try{return new URL(u,location.href).href}catch(e){return clean(u)}};document.querySelectorAll('#uscraper-normalized-rows').forEach(e=>e.remove());const box=document.createElement('div');box.id='uscraper-normalized-rows';box.style.display='none';document.documentElement.appendChild(box);const isDetailHref=h=>/\\/annonces\\/vente\\//i.test(h)&&!/\\/recherche/i.test(h)&&!/(?:jpg|jpeg|png|webp)(?:$|\\?)/i.test(h);function pickRoot(link){let best=null,n=link;for(let i=0;i<9&&n&&n!==document.body;i++,n=n.parentElement){const t=clean(n.innerText);if(t.length>60&&t.length<7000&&/(€|EUR|m[²2]|pi[eè]ces?|chambres?)/i.test(t))best=n}return best||link.closest('article,li,section,div')||link}const links=Array.from(document.querySelectorAll('a[href]')).filter(a=>isDetailHref(a.href));const seen=new Set();const items=[];links.forEach(a=>{const href=abs(a.href.split('#')[0]);if(seen.has(href))return;seen.add(href);items.push({root:pickRoot(a),href,link:a})});function getJsonObjects(){const out=[];const walk=o=>{if(!o||typeof o!=='object')return;out.push(o);Object.values(o).forEach(walk)};Array.from(document.scripts).filter(s=>s.type==='application/ld+json').forEach(s=>{try{const j=JSON.parse(s.textContent);(Array.isArray(j)?j:[j]).forEach(walk)}catch(e){}});return out}function fromDetailBody(){if(!/\\/annonces\\/vente\\//i.test(location.href))return null;if(/captcha-delivery|DataDome|device check/i.test(document.documentElement.innerHTML))return null;return {root:document.body,href:location.href,link:null,json:getJsonObjects()}}if(items.length===0){const bodyItem=fromDetailBody();if(bodyItem)items.push(bodyItem)}function firstMeta(name){return clean(document.querySelector('meta[property=\"'+name+'\"],meta[name=\"'+name+'\"]').content||'')}function findAgency(root,source,lines,json){let agency='';const text=clean(source);const pats=[/(?:L[’']agence|l[’']agence|agence)\\s+(.{2,90}?)\\s+(?:vous|a le plaisir|présente|presente|propose|met|offre)/i,/(?:par|chez)\\s+(.{2,90}?(?:Immobilier|Immobilière|Realty|Estate|Properties|Propriétés|Proprietes|Barnes|Coldwell|Feau|Sotheby|Privilege|Privilège|Agence))\\b/i,/\\b((?:BARNES|Coldwell Banker|COLDWELL BANKER|Daniel FEAU|DANIEL FEAU|NORMANDIE PRIVILEGE|Normandie Privilège|Agence Winter|A TEAM REAL ESTATE|Mercure|Sotheby's|Kretz|Junot|Emile Garcin)[A-Za-zÀ-ÿ0-9&' .-]{0,80})\\b/];for(const p of pats){const m=text.match(p);if(m&&!badAgency(m[1])){agency=clean(m[1]);break}}if(!agency){const line=lines.find(l=>!badAgency(l)&&/(BARNES|COLDWELL|IMMOB|REALTY|ESTATE|PROPERTIES|PROPRIETES|AGENCE|SOTHEBY|FEAU|PRIVILEGE|PRIVILÈGE|MERCURE|KRETZ|DANIEL|CABINET|TRANSACTIONS|SARL|WINTER)/i.test(l));if(line)agency=clean(line.replace(/^(?:L[’']agence|Agence)\\s+/i,''))}if(!agency&&json&&json.length){const org=json.find(o=>o.seller||o.provider||o.brand)||json.find(o=>o.name&&/Organization|RealEstateAgent|LocalBusiness/i.test(String(o['@type']||'')));agency=clean(org?.seller?.name||org?.provider?.name||org?.brand?.name||org?.name||'')}if(!agency){const el=root.querySelector('a[href*=\"agence\" i],a[href*=\"professionnel\" i],a[href*=\"immobilier\" i],[data-testid*=\"agency\" i],[data-testid*=\"agence\" i],[class*=\"agency\" i],[class*=\"agence\" i]');const val=clean(el?.textContent||'');if(!badAgency(val))agency=val}return badAgency(agency)?'':agency}function make(item){const root=item.root||document.body;const txt=clean(root.innerText||'');const rawLines=(root.innerText||'').split(/\\n+/).map(clean).filter(Boolean);const lines=rawLines.length?rawLines:txt.split(/(?<=\\S)\\s{2,}/).map(clean).filter(Boolean);const json=item.json||[];const jsonText=clean(json.map(o=>[o.name,o.headline,o.description,o['@type']].filter(Boolean).join(' ')).join(' '));const title=clean(root.querySelector('h1,h2,h3,[class*=title i],[class*=titre i]')?.textContent||item.link?.getAttribute('title')||item.link?.textContent||firstMeta('og:title')||document.title);const source=clean([title,txt,jsonText].join(' '));let type=(source.match(/\\b(Appartement|Maison|Villa|Manoir|Château|Chateau|Propriété|Propriete|Hôtel particulier|Hotel particulier|Loft|Terrain|Duplex|Penthouse)\\b/i)||[])[1]||'';let pieces=(source.match(/(\\d+)\\s*pi[eè]ces?/i)||[])[1]||'';let areaMatch=source.match(/(\\d+(?:[,.]\\d+)?)\\s*m[²2]/i);let espace=areaMatch?clean(areaMatch[1]+' m²'):'';let price=(source.match(/\\d[\\d\\s\\u00a0.]{2,}\\s*(?:€|EUR)/i)||[])[0]||'';let address='';let afterArea=source.match(/m[²2]\\s+([^€]{2,120}?)(?=\\s+\\d[\\d\\s\\u00a0.]{2,}\\s*(?:€|EUR)|\\s+Appartement|\\s+Maison|$)/i);if(afterArea)address=clean(afterArea[1].replace(/^(?:à|a)\\s+/i,''));if(!address){address=clean(root.querySelector('[class*=address i],[class*=adresse i],[class*=localisation i],[class*=location i]')?.textContent||'')}if(!address){address=lines.find(l=>/,/.test(l)&&!/€|Budget|Message envoyé/i.test(l))||''}if(!address){address=lines.find(l=>/\\b(?:Paris|Nice|Cap Ferret|Bayeux|Isigny|Brantôme|Brantome|France)\\b/i.test(l))||''}let img=root.querySelector('img[src*=\"seloger\"],img[src*=\"visuels\"],img[src]');let photo=clean(img?.currentSrc||img?.src||firstMeta('og:image'));let desc=clean(root.querySelector('[class*=description i],[class*=descriptif i],[data-testid*=description i]')?.textContent||'');if(!desc){desc=lines.filter(l=>l.length>80&&!/budget|message envoyé|cookies/i.test(l)).sort((a,b)=>b.length-a.length)[0]||firstMeta('description')||''}let agency=findAgency(root,clean([desc,source].join(' ')),lines,json);let phone=(txt.match(/(?:\\+33|0)\\s*(?:\\(?0\\)?\\s*)?(?:[1-9](?:[\\s.\\-]*\\d{2}){4}|\\d(?:[\\s.\\-]*\\d){8,})/)||[])[0]||'';if(json&&json.length){const objs=json;const addrObj=objs.find(o=>o.address)?.address;if(!address&&typeof addrObj==='string')address=addrObj;if(!address&&addrObj&&typeof addrObj==='object')address=clean([addrObj.streetAddress,addrObj.addressLocality,addrObj.postalCode,addrObj.addressRegion,addrObj.addressCountry].filter(Boolean).join(', '));const offer=objs.find(o=>o.price||o.priceSpecification||o.offers)||{};if(!price)price=clean(offer.price||offer.priceSpecification?.price||offer.offers?.price||'');let ji=objs.map(o=>o.image||o.photo).find(Boolean);if(Array.isArray(ji))ji=ji[0];if(ji&&typeof ji==='object')ji=ji.url||ji.contentUrl;if(!photo)photo=clean(ji);if(!desc)desc=clean(objs.find(o=>o.description)?.description||'')}const r=document.createElement('div');r.className='uscraper-row';r.setAttribute('data-type_de_logement',clean(type));r.setAttribute('data-pieces',clean(pieces));r.setAttribute('data-espace',clean(espace));r.setAttribute('data-adresse',clean(address));r.setAttribute('data-prix_total',clean(price));r.setAttribute('data-agences_immobilieres',clean(agency));r.setAttribute('data-url_du_page_detaille',clean(item.href||location.href));r.setAttribute('data-photo_url',clean(photo));r.setAttribute('data-description',clean(desc));r.setAttribute('data-telephone',clean(phone));box.appendChild(r)}items.forEach(make);})();",
        "waitForCompletion": true,
        "timeout": 15
      }
    },
    {
      "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": ".uscraper-row",
        "timeout": 15,
        "visible": false
      }
    },
    {
      "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": ".uscraper-row",
        "fileName": "belles-demeures-biens-a-vendre-scraper-v4.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "type_de_logement",
            "selector": "",
            "attribute": "data-type_de_logement"
          },
          {
            "name": "pieces",
            "selector": "",
            "attribute": "data-pieces"
          },
          {
            "name": "espace",
            "selector": "",
            "attribute": "data-espace"
          },
          {
            "name": "adresse",
            "selector": "",
            "attribute": "data-adresse"
          },
          {
            "name": "prix_total",
            "selector": "",
            "attribute": "data-prix_total"
          },
          {
            "name": "agences_immobilieres",
            "selector": "",
            "attribute": "data-agences_immobilieres"
          },
          {
            "name": "url_du_page_detaille",
            "selector": "",
            "attribute": "data-url_du_page_detaille"
          },
          {
            "name": "photo_url",
            "selector": "",
            "attribute": "data-photo_url"
          },
          {
            "name": "description",
            "selector": "",
            "attribute": "data-description"
          },
          {
            "name": "telephone",
            "selector": "",
            "attribute": "data-telephone"
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 2280,
      "position_y": 260,
      "config": {
        "selector": "nav[aria-label*=\"pagination\" i] a[rel=\"next\"], nav[aria-label*=\"pagination\" i] a[aria-label*=\"Suivant\" i], ul[class*=\"pagination\" i] a[rel=\"next\"], ul[class*=\"pagination\" i] a[aria-label*=\"Suivant\" i], a[rel=\"next\"][href*=\"LISTING-LISTpg\"], a[rel=\"next\"][href*=\"page\"]"
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2280,
      "position_y": 620,
      "config": {}
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2640,
      "position_y": 620,
      "config": {
        "selector": "nav[aria-label*=\"pagination\" i] a[rel=\"next\"], nav[aria-label*=\"pagination\" i] a[aria-label*=\"Suivant\" i], ul[class*=\"pagination\" i] a[rel=\"next\"], ul[class*=\"pagination\" i] a[aria-label*=\"Suivant\" i], a[rel=\"next\"][href*=\"LISTING-LISTpg\"], a[rel=\"next\"][href*=\"page\"]",
        "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": 3000,
      "position_y": 620,
      "config": {
        "timeout": 45
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3360,
      "position_y": 620,
      "config": {
        "duration": 3
      }
    }
  ],
  "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": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-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": "false",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "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": "inject-javascript-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-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1128,
      "position_y": 156,
      "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": 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": 2208,
      "position_y": 156,
      "width": 680,
      "height": 656,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "loop-continue-1",
          "click-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Equivalent UScraper template for the Octoparse Belles Demeures real-estate scraper. It accepts multiple BellesDemeures sale/detail/search URLs, normalizes visible property cards/detail content into internal .uscraper-row records, and exports type, rooms, area, address, price, agency, detail URL, photo URL, description, and phone. Uses a multi-URL loop and conservative search-result pagination. The provided sample detail URLs may redirect to expired/search pages; this template extracts active replacement listing cards when that happens. Initial analysis detected DataDome/HTTP 403, so trusted profile/proxy/manual clearance may be required.",
      "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 5 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-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(function(){const clean=v=>v==null?'':String(v).replace(/\\s+/g,' ').trim();const badAgency=v=>!v||/m...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1400,
      "position_y": 240,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `nav[aria-label*=\"pagination\" i] a[rel=\"next\"], nav[aria-label*=\"pagination\" i] a[aria-label*=\"Suivant\" i], ul[class*=\"pa`. 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": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-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": 600,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}