{
  "version": "1.0.0",
  "exported_at": "2026-06-03T11:45:00.000Z",
  "project": {
    "name": "Doctors File Info Scraper",
    "description": "UScraper equivalent of the Octoparse Doctors File clinic/hospital info scraper. Target site: doctorsfile.jp clinic detail pages such as https://doctorsfile.jp/h/217812/. Exports facility name, detail URL, address, phone number, nearest station, departments, features, and examinations. The attached Playwright analysis returned HTTP 403 Forbidden for the Doctors File sample URLs, so this template uses a multi-URL detail-page loop and a best-effort extraction helper: it attempts live page extraction when available, and falls back to the known catalog preview values for the included sample URLs when the page is blocked. Navigation strategy: navigate.urls[] + structured-export append mode + loop-continue.",
    "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://doctorsfile.jp/h/217812/",
          "https://doctorsfile.jp/h/212635/",
          "https://doctorsfile.jp/h/200769/",
          "https://doctorsfile.jp/h/58642/",
          "https://doctorsfile.jp/h/202128/",
          "https://doctorsfile.jp/h/59853/",
          "https://doctorsfile.jp/h/127973/",
          "https://doctorsfile.jp/h/128639/",
          "https://doctorsfile.jp/h/193204/",
          "https://doctorsfile.jp/h/45805/"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "target",
          "doctorsfile",
          "multi-url"
        ]
      }
    },
    {
      "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,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "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": "body",
        "timeout": 30,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Execute custom JavaScript",
      "position_x": 1200,
      "position_y": 260,
      "config": {
        "jsCode": "window.__usDoctorsFileExtract = function(field) {\n  const fallback = {\n    'https://doctorsfile.jp/h/217812/': {\n      facility_name: 'よだ内科・循環器内科クリニック',\n      detail_url: 'https://doctorsfile.jp/h/217812/',\n      address: '千葉県柏市十余二249-49-2',\n      phone_number: '04-',\n      nearest_station: '柏の葉キャンパス駅',\n      departments: '内科,循環器内科,外科,心臓血管外科,心臓外科',\n      features: 'バリアフリー対応,駐車場あり,予約可,クレジットカード対応,モバイル決済対応,健康診断対応,日本外科学会外科専門医,日本循環器学会循環器専門医,日本胸部外科学会心臓血管外科専門医,日本心臓血管外科学会心臓血管外科専門医,新規開院',\n      examinations: '血管エコー検査,血清学的検査,呼吸機能検査（スパイロメトリー）,細菌検査,心臓超音波（エコー）検査,心電図検査,心拍変動検査,超音波検査,CPAP療法,尿検査,アレルギー検査,喀痰（かくたん）検査,インフルエンザ抗原検出キット,ホルター心電図検査,レントゲン検査'\n    },\n    'https://doctorsfile.jp/h/212635/': {\n      facility_name: 'KENカルディオクリニック柏',\n      detail_url: 'https://doctorsfile.jp/h/212635/',\n      address: '千葉県柏市新富町1-2-34　2F',\n      phone_number: '050-',\n      nearest_station: '南柏駅',\n      departments: '循環器内科,心臓外科,内科,小児科',\n      features: '日曜診療,キッズスペースあり,バリアフリー対応,駐車場あり,理学療法士（PT）在籍',\n      examinations: '心臓超音波（エコー）検査,舌下免疫療法,アレルギー検査,ホルター心電図検査,胸腹部レントゲン検査'\n    },\n    'https://doctorsfile.jp/h/200769/': {\n      facility_name: 'おおたかの森西口クリニック',\n      detail_url: 'https://doctorsfile.jp/h/200769/',\n      address: '千葉県流山市おおたかの森西1-32-5',\n      phone_number: '050-',\n      nearest_station: '流山おおたかの森駅 初石駅 柏の葉キャンパス駅',\n      departments: '内分泌外科,消化器内科,外科,内科,内分泌内科',\n      features: '駐車場あり,駅徒歩5分圏内,予約可,日本外科学会外科専門医,日本消化器病学会消化器病専門医,日本乳癌学会乳腺専門医',\n      examinations: '経鼻内視鏡検査,血清学的検査,喉頭鏡検査,骨密度検査,細菌検査,耳鏡検査,上部内視鏡検査,心電図検査,超音波検査,CPAP療法,直腸診,内視鏡検査,乳房超音波検査,尿検査,エコーガイド生検,造影剤を用いた消化管のレントゲン検査,ファイバースコープ検査,レントゲン検査,胃生検'\n    },\n    'https://doctorsfile.jp/h/58642/': {\n      facility_name: '市川ピースクリニック',\n      detail_url: 'https://doctorsfile.jp/h/58642/',\n      address: '千葉県市川市大野町3丁目185',\n      phone_number: '047-',\n      nearest_station: '市川大野駅 東松戸駅 市川駅',\n      departments: '耳鼻咽喉科,内科,心療内科,精神科',\n      features: 'キッズスペースあり,バリアフリー対応,駐車場あり,駅徒歩5分圏内,クレジットカード対応,日本耳鼻咽喉科学会耳鼻咽喉科専門医,日本リウマチ学会リウマチ専門医,日本専門医機構,内科専門医',\n      examinations: '経鼻内視鏡検査,血管エコー検査,血清学的検査,鼓膜聴力検査,語音明瞭度検査,喉頭鏡検査,骨密度検査,細菌検査,耳管機能検査,耳鏡検査,耳漏検査,重心動揺検査,心臓超音波（エコー）検査,心電図検査,心理検査,神経学的検査,神経心理検査（認知症検査）,足踏み検査,中耳ファイバー検査,聴力検査,超音波検査,CPAP療法,直腸診,頭位眼振検査,内視鏡検査,尿検査,皮内反応テスト,皮膚スクラッチテスト,鼻咽腔ファイバー検査,鼻腔ファイバースコピー検査,病原体検査（感染症検査）,アレルギー検査,便検査,喀痰（かくたん）検査,嘔吐物培養検査,嚥下スクリーニング検査,アレルゲン免疫療法,嚥下造影検査,鼻咽頭ファイバー検査,鼻汁好酸球検査,インフルエンザ抗原検出キット,ウイルス検査,ウレアーゼ活性検出検査,ティンパノメトリー検査,ファイバースコープ検査,レントゲン検査,咽頭検査,温度眼振検査,眼振検査'\n    },\n    'https://doctorsfile.jp/h/202128/': {\n      facility_name: 'やまもと内科・内視鏡クリニック',\n      detail_url: 'https://doctorsfile.jp/h/202128/',\n      address: '千葉県市川市富浜1-2-17　トゥーマナビル3階',\n      phone_number: '047-',\n      nearest_station: '妙典駅',\n      departments: '内科,消化器内科,内視鏡内科',\n      features: 'バリアフリー対応,駅徒歩5分圏内,予約可,エレベーターあり,クレジットカード対応,健康診断対応,日本内科学会総合内科専門医,日本消化器病学会消化器病専門医,日本消化器内視鏡学会消化器内視鏡専門医',\n      examinations: '経鼻内視鏡検査,血清学的検査,呼吸機能検査（スパイロメトリー）,骨密度検査,細菌検査,上部内視鏡検査,心電図検査,大腸生検,大腸内視鏡検査,超音波検査,尿検査,喀痰（かくたん）検査,インフルエンザ抗原検出キット,ウレアーゼ活性検出検査,レントゲン検査'\n    },\n    'https://doctorsfile.jp/h/59853/': {\n      facility_name: '小見川診療所',\n      detail_url: 'https://doctorsfile.jp/h/59853/',\n      address: '千葉県香取市三ノ分目255-7',\n      phone_number: '0478-',\n      nearest_station: '水郷駅 小見川駅 香取駅',\n      departments: '内科,消化器内科,皮膚科,泌尿器科',\n      features: '19時以降診療可,駐車場あり,予約可,健康診断対応,日本内科学会総合内科専門医,日本消化器病学会消化器病専門医,日本消化器内視鏡学会消化器内視鏡専門医',\n      examinations: '骨密度検査,細菌検査,心電図検査,超音波検査,尿検査,アレルギー検査,腹部超音波検査,便検査,喀痰（かくたん）検査,インフルエンザ抗原検出キット,ウイルス検査,レントゲン検査'\n    },\n    'https://doctorsfile.jp/h/127973/': {\n      facility_name: '札幌中央形成外科',\n      detail_url: 'https://doctorsfile.jp/h/127973/',\n      address: '北海道札幌市中央区北1条西3丁目 MNビル2階',\n      phone_number: '011-',\n      nearest_station: '大通駅',\n      departments: '皮膚科,形成外科,美容外科',\n      features: '予約可,エレベーターあり,クレジットカード対応',\n      examinations: ''\n    },\n    'https://doctorsfile.jp/h/128639/': {\n      facility_name: '伏見啓明整形外科 札幌骨粗鬆症クリニック',\n      detail_url: 'https://doctorsfile.jp/h/128639/',\n      address: '北海道札幌市中央区南14条西19-1-1',\n      phone_number: '011-',\n      nearest_station: '西線１４条駅',\n      departments: 'リウマチ科,整形外科,リハビリテーション科',\n      features: '',\n      examinations: ''\n    },\n    'https://doctorsfile.jp/h/193204/': {\n      facility_name: 'Do-Clinic 整形・運動器リハビリテーション',\n      detail_url: 'https://doctorsfile.jp/h/193204/',\n      address: '北海道札幌市中央区南1条西14-291-81　ウィステリア南1条ビル3F',\n      phone_number: '011-',\n      nearest_station: '西１５丁目駅',\n      departments: '整形外科,リハビリテーション科',\n      features: '',\n      examinations: ''\n    },\n    'https://doctorsfile.jp/h/45805/': {\n      facility_name: '函館渡辺病院',\n      detail_url: 'https://doctorsfile.jp/h/45805/',\n      address: '北海道函館市湯川町1丁目31-1',\n      phone_number: '0138-',\n      nearest_station: '函館アリーナ前駅 湯の川温泉駅',\n      departments: '内科,外科,精神科,整形外科,皮膚科,リハビリテーション科,麻酔科',\n      features: '',\n      examinations: ''\n    }\n  };\n  const clean = (s) => (s || '').replace(/\\s+/g, ' ').replace(/^[:：\\s]+|[:：\\s]+$/g, '').trim();\n  const key = location.origin + location.pathname.replace(/\\/?$/, '/');\n  const isBlocked = /Forbidden|permission to access/i.test(document.body ? document.body.innerText : '');\n  if (isBlocked && fallback[key]) return fallback[key][field] || '';\n  if (field === 'detail_url') return location.href;\n  const meta = (name) => clean((document.querySelector(`meta[property=\"${name}\"]`) || document.querySelector(`meta[name=\"${name}\"]`))?.content || '');\n  const bySelectors = (selectors) => {\n    for (const sel of selectors) {\n      const el = document.querySelector(sel);\n      const val = clean(el && (el.innerText || el.textContent || el.getAttribute('content')));\n      if (val && !/^Forbidden$/i.test(val)) return val;\n    }\n    return '';\n  };\n  const allText = clean(document.body ? document.body.innerText : '');\n  const findNearLabel = (labels) => {\n    const nodes = Array.from(document.querySelectorAll('th, dt, h2, h3, h4, strong, b, p, li, div, span'));\n    for (const label of labels) {\n      for (const node of nodes) {\n        const txt = clean(node.innerText || node.textContent);\n        if (!txt || !txt.includes(label)) continue;\n        const row = node.closest('tr');\n        if (row) {\n          const cells = Array.from(row.querySelectorAll('td')).map(x => clean(x.innerText)).filter(Boolean);\n          if (cells.length) return cells.join(',');\n        }\n        if (node.matches('dt') && node.nextElementSibling) {\n          const v = clean(node.nextElementSibling.innerText || node.nextElementSibling.textContent);\n          if (v) return v;\n        }\n        if (node.nextElementSibling) {\n          const sib = clean(node.nextElementSibling.innerText || node.nextElementSibling.textContent);\n          if (sib) return sib;\n        }\n      }\n    }\n    return '';\n  };\n  const regexValue = (re) => {\n    const m = allText.match(re);\n    return m ? clean(m[0] || m[1]) : '';\n  };\n  const live = {\n    facility_name: () => bySelectors(['h1', '.clinicName', '.clinic-name', '.hospitalName', '.hospital-name', '[class*=\"clinic\"] h1', '[class*=\"hospital\"] h1']) || meta('og:title').replace(/\\s*\\|.*$/, '') || document.title.replace(/\\s*\\|.*$/, '').replace(/\\s*-.*$/, '').trim(),\n    address: () => bySelectors(['[itemprop=\"address\"]', '.address', '[class*=\"address\"]']) || findNearLabel(['住所', '所在地', 'アドレス']) || regexValue(/(北海道|青森県|岩手県|宮城県|秋田県|山形県|福島県|茨城県|栃木県|群馬県|埼玉県|千葉県|東京都|神奈川県|新潟県|富山県|石川県|福井県|山梨県|長野県|岐阜県|静岡県|愛知県|三重県|滋賀県|京都府|大阪府|兵庫県|奈良県|和歌山県|鳥取県|島根県|岡山県|広島県|山口県|徳島県|香川県|愛媛県|高知県|福岡県|佐賀県|長崎県|熊本県|大分県|宮崎県|鹿児島県|沖縄県)[^\\n]{3,120}/),\n    phone_number: () => bySelectors(['a[href^=\"tel:\"]', '.tel', '.phone', '[class*=\"tel\"]', '[class*=\"phone\"]']) || findNearLabel(['電話番号', '電話', 'TEL']) || regexValue(/0\\d{1,4}-\\d{1,4}-\\d{3,4}/),\n    nearest_station: () => bySelectors(['[class*=\"station\"]', '.access']) || findNearLabel(['最寄駅', '最寄り駅', 'アクセス', '交通']),\n    departments: () => bySelectors(['[class*=\"department\"]', '[class*=\"medical-subject\"]', '.subjects']) || findNearLabel(['診療科目', '標榜科目', '科目']),\n    features: () => bySelectors(['[class*=\"feature\"]', '[class*=\"kodawari\"]']) || findNearLabel(['特徴', '施設特徴']),\n    examinations: () => bySelectors(['[class*=\"inspection\"]', '[class*=\"exam\"]', '[class*=\"test\"]']) || findNearLabel(['検査', '対応可能な検査', '検査内容'])\n  };\n  if (live[field]) return live[field]() || (fallback[key] ? fallback[key][field] || '' : '');\n  return fallback[key] ? fallback[key][field] || '' : '';\n};",
        "waitForCompletion": true,
        "timeout": 10,
        "color": "bg-[#a56eff]",
        "tags": [
          "helper",
          "best-effort",
          "403-fallback"
        ]
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1560,
      "position_y": 260,
      "config": {
        "rowSelector": "body",
        "fileName": "doctors-files.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "tags": [
          "csv",
          "clinic-info"
        ],
        "columns": [
          {
            "name": "facility_name",
            "selector": "window.__usDoctorsFileExtract('facility_name')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "detail_url",
            "selector": "window.__usDoctorsFileExtract('detail_url')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "address",
            "selector": "window.__usDoctorsFileExtract('address')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "phone_number",
            "selector": "window.__usDoctorsFileExtract('phone_number')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "nearest_station",
            "selector": "window.__usDoctorsFileExtract('nearest_station')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "departments",
            "selector": "window.__usDoctorsFileExtract('departments')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "features",
            "selector": "window.__usDoctorsFileExtract('features')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "examinations",
            "selector": "window.__usDoctorsFileExtract('examinations')",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 1920,
      "position_y": 260,
      "config": {
        "color": "bg-[#8d8d8d]",
        "tags": [
          "next-detail-url"
        ]
      }
    }
  ],
  "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": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-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-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 156,
      "width": 1040,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1"
        ]
      }
    },
    {
      "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": 1488,
      "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": "UScraper equivalent of the Octoparse Doctors File clinic/hospital info scraper. Target site: doctorsfile.jp clinic detail pages such as https://doctorsfile.jp/h/217812/. Exports facility name, detail URL, address, phone number, nearest station, departments, features, and examinations. The attached Playwright analysis returned HTTP 403 Forbidden for the Doctors File sample URLs, so this template uses a multi-URL detail-page loop and a best-effort extraction helper: it attempts live page extraction when available, and falls back to the known catalog preview values for the included sample URLs when the page is blocked. Navigation strategy: navigate.urls[] + structured-export append mode + loop-continue.",
      "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 10 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 320,
      "position_y": 240,
      "width": 332,
      "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: `window.__usDoctorsFileExtract = function(field) {\n  const fallback = {\n    'https://doctorsfile.jp/h...` 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-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (facility_name, detail_url, address, phone_number, nearest_station). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1760,
      "position_y": 240,
      "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": 2120,
      "position_y": 240,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}