{
  "version": "1.0.0",
  "exported_at": "2026-06-01T13:30:00.000Z",
  "project": {
    "name": "Apamanshop Rental Listings Scraper",
    "description": "Best-effort Apamanshop rental listing scraper equivalent to the Octoparse template. It targets the inferred Sapporo Chuo-ku listing page at https://www.apamanshop.com/hokkaido/101/ and extracts keyword, page number, property name, property type, age, address, room floor, rent, fees, deposit/key money, layout, area, and listing URL. The Octoparse sample detail URLs currently return 404, so selectors use the live listing page. Pagination is handled by clicking an enabled Japanese/next pagination link until none remains; structured export appends all pages to one CSV. Refined after test run to exclude inquiry links and avoid post-click page-load timeouts by using sleep plus row wait.",
    "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": 220,
      "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": 220,
      "config": {
        "url": "https://www.apamanshop.com/hokkaido/101/",
        "color": "bg-[#08bdba]"
      }
    },
    {
      "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": 220,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "selector": "a[href*=\"/hokkaido/101/b\"][href*=\"/20\"]:not([href*=\"/inquiry/\"])",
        "timeout": 30,
        "visible": true,
        "color": "bg-[#42be65]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1560,
      "position_y": 220,
      "config": {
        "rowSelector": "a[href*=\"/hokkaido/101/b\"][href*=\"/20\"]:not([href*=\"/inquiry/\"])",
        "fileName": "apamanshop-rental-listings-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "keyword",
            "selector": "'札幌市中央区'",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "page_number",
            "selector": "(()=>{const u=new URL(location.href); const q=u.searchParams.get('page')||u.searchParams.get('p')||u.searchParams.get('page_no'); if(q) return q; const els=Array.from(document.querySelectorAll('.current,.active,.now,strong,span,li')); const hit=els.find(e=>/current|active|now/.test(String(e.className||'')) && /^\\d+$/.test((e.textContent||'').trim())); return hit?(hit.textContent||'').trim():'1';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "property_name",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const lines=(card.innerText||'').split(/\\n+/).map(s=>s.replace(/\\s+/g,' ').trim()).filter(Boolean); const bad=/詳細|お問い合わせ|お気に入り|空室|電話|メール|賃料|家賃|管理費|共益費|敷金|礼金|保証金|権利金|間取り|専有面積|北海道|徒歩|地下鉄|ＪＲ|JR|バス|[0-9]+(?:\\.[0-9]+)?万円|[0-9]+(?:\\.[0-9]+)?\\s*(?:m²|㎡|m2)|^\\d+階$/i; const hit=lines.find(s=>s.length>1&&s.length<80&&!bad.test(s)); return hit||'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "property_type",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(マンション|アパート|一戸建て|戸建て|テラスハウス|ハイツ|コーポ)/); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "building_age",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(新築|築\\s*\\d+年|築年数\\s*[:：]?\\s*\\d+年)/); return m?m[1].replace(/\\s+/g,''):'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "address",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(北海道[^\\n\\r]+?)(?:\\s+(?:交通|最寄|地下鉄|ＪＲ|JR|バス|間取り|賃料|築|マンション|アパート)|$)/); return m?m[1].trim():'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "room_floor",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/((?:地下|B)?\\d+階|\\d+\\/\\d+階)/); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rent",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(?:賃料|家賃)?\\s*([0-9]+(?:\\.[0-9]+)?万円)/); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "management_fee",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(?:管理費|共益費)\\s*[:：]?\\s*([0-9,]+円|－|-|なし|無料)/); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "deposit_guarantee_money",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(?:敷金|保証金)\\s*[:：]?\\s*([0-9,]+円|[0-9]+(?:\\.[0-9]+)?ヶ月|－|-|なし)/); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "key_money_rights_money",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(?:礼金|権利金)\\s*[:：]?\\s*([0-9,]+円|[0-9]+(?:\\.[0-9]+)?ヶ月|－|-|なし)/); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "layout",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/(\\d+[SLDKR]+|\\d+[ＳＬＤＫＲ]+|ワンルーム)/i); return m?m[1]:'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "area",
            "selector": "(()=>{let e=ROW,card=ROW; for(let i=0;i<12&&e;i++,e=e.parentElement){const t=(e.innerText||'').replace(/\\s+/g,' ').trim(); if(/[0-9]+(?:\\.[0-9]+)?万円/.test(t)&&/(m²|㎡|m2)/i.test(t)){card=e;break;} card=e;} const t=(card.innerText||'').replace(/\\s+/g,' ').trim(); const m=t.match(/([0-9]+(?:\\.[0-9]+)?\\s*(?:m²|㎡|m2))/i); return m?m[1].replace(/\\s+/g,''):'';})()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "page_url",
            "selector": "ROW.href || ROW.getAttribute('href') || location.href",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 1920,
      "position_y": 220,
      "config": {
        "selector": "//a[(contains(normalize-space(.), '次') or contains(@class, 'next') or contains(@rel, 'next')) and @href and not(contains(@href, 'javascript')) and not(contains(@class, 'disabled')) and not(contains(@class, 'disable')) and not(contains(@class, 'off')) and not(ancestor-or-self::*[contains(@class, 'disabled') or contains(@class, 'disable') or contains(@class, 'off')])]",
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2280,
      "position_y": 500,
      "config": {
        "selector": "//a[(contains(normalize-space(.), '次') or contains(@class, 'next') or contains(@rel, 'next')) and @href and not(contains(@href, 'javascript')) and not(contains(@class, 'disabled')) and not(contains(@class, 'disable')) and not(contains(@class, 'off')) and not(ancestor-or-self::*[contains(@class, 'disabled') or contains(@class, 'disable') or contains(@class, 'off')])]",
        "timeout": 10,
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2640,
      "position_y": 500,
      "config": {
        "duration": 3,
        "color": "bg-[#ff832b]"
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 1920,
      "position_y": 620,
      "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": "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": "click-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": "click-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": "wait-for-element-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 48,
      "position_y": 116,
      "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": 116,
      "width": 2480,
      "height": 576,
      "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": 1488,
      "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": 1848,
      "position_y": 116,
      "width": 680,
      "height": 576,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 1848,
      "position_y": 516,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Apamanshop rental listing scraper equivalent to the Octoparse template. It targets the inferred Sapporo Chuo-ku listing page at https://www.apamanshop.com/hokkaido/101/ and extracts keyword, page number, property name, property type, age, address, room floor, rent, fees, deposit/key money, layout, area, and listing URL. The Octoparse sample detail URLs currently return 404, so selectors use the live listing page. Pagination is handled by clicking an enabled Japanese/next pagination link until none remains; structured export appends all pages to one CSV. Refined after test run to exclude inquiry links and avoid post-click page-load timeouts by using sleep plus row wait.",
      "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 (keyword, page_number, property_name, property_type, building_age). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1760,
      "position_y": 200,
      "width": 340,
      "height": 135,
      "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 `//a[(contains(normalize-space(.), '次') or contains(@class, 'next') or contains(@rel, 'next')) and @href and not(contains`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 200,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Uses XPath `//a[(contains(normalize-space(.), '次') or contains(@class, 'next') or contains(@rel, 'next')) and @h`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 480,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}