# 美聯物業爬蟲｜香港樓盤、成交紀錄、屋苑資料一鍵匯出（免 API） (`claude_code_reviewer/midland-scraper`) Actor

免登入抓香港美聯物業公開資料：4.4 萬在售出租樓盤、190 萬筆歷史成交、1.8 萬個屋苑，含售價、月租、實用面積、實用呎價、房廳、小學校網與經緯度，輸出 JSON／CSV／Excel。香港房產市調、估價模型與代理庫存比較必備。

- **URL**: https://apify.com/claude\_code\_reviewer/midland-scraper.md
- **Developed by:** [Chad](https://apify.com/claude_code_reviewer) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 樓盤／成交／屋苑

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## 香港美聯物業爬蟲（Midland Realty Scraper）

一個 Actor 抓香港**美聯物業**（Midland Realty）的公開資料：**在售／出租樓盤**、**歷史成交紀錄**、**全港屋苑目錄**。走公開 JSON API，不用登入、不用申請 API key、不開瀏覽器。

美聯是香港分行數最多的地產代理，資料量比多數同類來源大一個級距：

| 模式 | 可抓總量 |
|---|---|
| 樓盤列表 | **44,190** 筆（放售 31,530／出租 15,563）|
| 成交紀錄 | **1,855,568** 筆 |
| 屋苑目錄 | **17,964** 個屋苑 |

### 輸出欄位

#### 樓盤列表（`mode: search`）

| 欄位 | 型別 | 說明 |
|---|---|---|
| `serial_no` | string | 美聯盤源編號，例如 `M351962478` |
| `deal_type` | string | `buy`（放售）或 `rent`（出租）|
| `region` | string|null | 區域：港島／九龍／新界 |
| `subregion` | string|null | 分區，例如 荃灣 |
| `district` | string|null | 地區，例如 馬灣 |
| `sm_district` | string|null | 小分區 |
| `estate` / `estate_id` | string|null | 屋苑名稱與美聯屋苑 ID |
| `phase` | string|null | 期數，例如 `1期` |
| `building` / `building_id` | string|null | 大廈名稱與 ID |
| `price_hkd` | number|null | 放售價（港元）。租盤為 `null` |
| `rent_hkd` | number|null | 月租（港元）。售盤為 `null` |
| `net_area_sqft` | number|null | 實用面積（平方呎）|
| `gross_area_sqft` | number|null | 建築面積（平方呎）|
| `net_to_gross_ratio` | number|null | 實用率（%）|
| `net_unit_price_hkd` | number|null | 實用呎價 |
| `monthly_mortgage_hkd` | number|null | 美聯試算的每月供款 |
| `bedroom` / `sitting_room` | number|null | 房數／廳數 |
| `orientation` | string|null | 座向，例如 南 |
| `primary_school_net` | number|null | 小學校網編號 |
| `has_video` / `has_photo_360` | boolean|null | 有無影片／360 相片 |
| `tags` | string\[]|null | 盤源標籤，例如 `sole`（獨家）|
| `agent_name_zh` / `agent_name_en` | string|null | 代理姓名 |
| `latitude` / `longitude` | number|null | 經緯度 |
| `photo_urls` | string\[]|null | 相片網址 |
| `listing_url` | string|null | 美聯盤源頁 |
| `updated_at` | string|null | 盤源更新時間（ISO 8601）|
| `scraped_at` | string | 抓取時間（ISO 8601）|

#### 成交紀錄（`mode: transactions`）

`transaction_id`、`region`／`subregion`／`district`、`estate`／`estate_id`、`building`、`floor`、`flat`、`price_hkd`、`net_area_sqft`、`gross_area_sqft`、`net_unit_price_hkd`、`transaction_date`、`transaction_type`、`source`（例如 `LANDREG` 田土廳）、`tags`、`latitude`／`longitude`、`transaction_url`、`updated_at`、`scraped_at`

#### 屋苑目錄（`mode: estates`）

`estate_id`、`name`、`region`／`subregion`／`district`／`sm_district`、`first_op_date`（入伙日期）、`total_unit_count`（總伙數）、`total_block_count`（座數）、`primary_school_net`、`sale_listing_count`／`rent_listing_count`（現有放盤／租盤數）、`net_unit_price_hkd`（近期實用呎價）、`recent_transaction_count`、`amenities`（周邊設施與步行分鐘）、`latitude`／`longitude`、`photo_url`、`estate_url`、`scraped_at`

> 所有欄位名稱一律英文 snake\_case；**缺值一律給 `null`，不會省略欄位**，方便直接寫進資料表。

### 模式

| 模式 | 抓什麼 | 主要用途 |
|---|---|---|
| `search` | 在售／出租樓盤列表 | 代理間庫存比較、選盤、價格監控 |
| `transactions` | 歷史成交紀錄 | 自建樓價指數、估值模型、成交趨勢 |
| `estates` | 屋苑目錄與統計 | 屋苑基本資料庫、供應量分析 |

### 輸入

| 欄位 | 型別 | 預設 | 說明 |
|---|---|---|---|
| `mode` | enum | `search` | `search` / `transactions` / `estates` |
| `dealType` | enum | `buy` | `buy` 放售、`rent` 出租（屋苑目錄模式不受影響）|
| `regions` | string\[] | 全部 | 港島／九龍／新界，留空＝三區全抓 |
| `bulkRegions` | string | — | 一行一個，與上面自動合併 |
| `bedrooms` | integer | — | 只留剛好 N 房 |
| `bathrooms` | integer | — | 只留剛好 N 個廁所 |
| `schoolNet` | integer | — | 只留指定小學校網 |
| `sort` | enum | `default` | 最新上架／價格／實用面積／實用呎價，可升可降 |
| `language` | enum | `zh-hk` | 地區與屋苑名稱的語言（欄位名恆為英文）|
| `maxItems` | integer | 50 | 本次最多輸出幾筆，上限 500 |
| `proxyConfiguration` | object | residential | **請保持預設**，見下方注意事項 |

### 輸入範例

**1. 九龍區放售樓盤 100 筆**

```json
{ "mode": "search", "dealType": "buy", "regions": ["九龍"], "maxItems": 100 }
```

**2. 全港三房放售盤，依實用呎價由低到高**

```json
{ "mode": "search", "dealType": "buy", "bedrooms": 3, "sort": "net_ft_price", "maxItems": 200 }
```

**3. 港島出租盤，英文地區名**

```json
{ "mode": "search", "dealType": "rent", "regions": ["Hong Kong Island"], "language": "en", "maxItems": 50 }
```

**4. 新界成交紀錄**

```json
{ "mode": "transactions", "dealType": "buy", "regions": ["新界"], "maxItems": 300 }
```

**5. 全港屋苑目錄**

```json
{ "mode": "estates", "maxItems": 500 }
```

### 注意事項

- **請保持 proxy 預設值（Apify residential）。** 美聯對 datacenter 出口一律回 403，連取存取權杖的頁面都拿不到。關掉 proxy 或改成 datacenter 會直接抓到 0 筆。JSON 回應每筆僅約 4KB，residential 流量成本可忽略。
- **可用的篩選條件只有 `regions`／`bedrooms`／`bathrooms`／`schoolNet`。** 美聯的公開 API 不接受屋苑名、地區細分、價格區間或面積區間的篩選——送了會被**靜默忽略**（回傳結果不變）。本 Actor 因此刻意不送這些參數，以免讓你以為有篩到。要按屋苑或價格過濾，請在拿到資料後自行篩選。
- `maxItems` 是**所有地區合計**的上限，不是每區。
- 售盤的 `rent_hkd` 與租盤的 `price_hkd` 會是 `null`（美聯原始資料在這些欄位給 0，我們正規化成 `null`，避免出現「售價 0 元」這種誤導值）。
- 抓取期間若有新盤上架，分頁內容會位移而出現重複；本 Actor 全 run 去重，同一筆只會輸出並計費一次。
- 只抓公開資料，不會登入、不繞過任何驗證。

### 計費

單一事件 `search-listing`，**每輸出一筆 $0.002**（三種模式相同）。只有成功寫進 dataset 的資料才計費；重複與被過濾掉的不收費。

### FAQ

**Q：可以只抓某個屋苑（例如太古城）的盤嗎？**
A：不行——美聯的公開 API 沒有屋苑或關鍵字篩選參數（我們實測過 `keyword`、`keywords`、`estate_id`、`q` 等，全部被忽略或會讓回應失效）。做法是用 `estates` 模式拿屋苑目錄、或用 `search` 抓該區後依 `estate` 欄位自行過濾。

**Q：成交紀錄可以回溯多久？**
A：資料庫有 185 萬筆，涵蓋田土廳登記（`source: LANDREG`）等來源。目前只支援依區域與買／租分頁抓取，沒有日期區間參數。

**Q：`net_area_sqft` 和 `gross_area_sqft` 差在哪？**
A：`net_area` 是實用面積、`area` 是建築面積，`net_to_gross_ratio` 是實用率。香港自 2013 年起以實用面積為法定標示，建議以 `net_area_sqft` 為準；部分盤源沒有建築面積，該欄位會是 `null`。

**Q：跟中原地產的資料可以合併比較嗎？**
A：可以。兩者都輸出 snake\_case、地區階層與屋苑名稱，適合做代理 A vs B 的庫存與定價比較。注意兩站的屋苑命名可能略有差異，建議用地區＋屋苑名做模糊比對。

**Q：為什麼一定要用 residential proxy？會很貴嗎？**
A：美聯擋 datacenter IP，沒有 residential 就完全拿不到資料。但這個 API 回應非常精簡（每筆約 4KB），實測流量成本遠低於每筆售價。

**Q：抓到的筆數比 `maxItems` 少？**
A：代表該篩選條件下的資料已經抓完。可以放寬條件（例如不指定 `bedrooms`）或改抓其他區域。

### 免責聲明

本 Actor 僅用於個人研究、學術分析、市場調查、房產趨勢研究等合法用途。使用時請遵守美聯物業（midland.com.hk）服務條款及香港相關法規。請勿大量爬取、勿商業轉售原始資料。作者不對任何因使用本工具造成的損害承擔責任。

***

香港樓盤爬蟲 美聯物業爬蟲 Midland Realty scraper 香港房產資料 HK property data 樓盤列表 成交紀錄 屋苑資料 實用呎價 香港地產代理 property listings Hong Kong real estate API 樓價指數 物業數據

***

### 📚 延伸教學與工具

這隻 actor 背後的實戰教學與免費工具，都在 **[AI Social API](https://aisocialapi.com/zh-hant/?utm_source=apify\&utm_medium=readme\&utm_campaign=midland-scraper)**：

- 📖 教學：[「有放盤」定「得出租」？地產代理話術一戳就穿——用四家代理的原始樓盤資料自己核實](https://aisocialapi.com/zh-hant/learn/hk-property-listing-verification/?utm_source=apify\&utm_medium=readme\&utm_campaign=midland-scraper)
- 📊 原創資料：[站台涵蓋表：模式、欄位與定價](https://aisocialapi.com/zh-hant/coverage/?utm_source=apify\&utm_medium=readme\&utm_campaign=midland-scraper) — 40 個站台各有哪些模式、實際回傳哪些欄位、每筆多少錢，全部從 actor 自己的 schema 生成
- 🛠 免費工具：[香港樓價查詢](https://aisocialapi.com/zh-hant/tools/hk-property/?utm_source=apify\&utm_medium=readme\&utm_campaign=midland-scraper) · [Apify 成本試算](https://aisocialapi.com/zh-hant/tools/apify-cost/?utm_source=apify\&utm_medium=readme\&utm_campaign=midland-scraper)
- 🤝 不想自己跑？[我幫你每天跑](https://aisocialapi.com/zh-hant/monitor/?utm_source=apify\&utm_medium=readme\&utm_campaign=midland-scraper)——排程好每天送進你的 Google Sheet 或 Slack，每月 US$299 起。

由實際經營 40+ 隻上架 actor 的人維護。

# Actor input Schema

## `mode` (type: `string`):

要抓什麼？選一個模式，填下面對應欄位就好。

## `dealType` (type: `string`):

抓買盤（放售）還是租盤（出租）。屋苑目錄模式不受此影響。

## `regions` (type: `array`):

要抓哪幾區。留空＝三區全抓。可填：港島 / 九龍 / 新界（也接受 Hong Kong Island、Kowloon、New Territories）。

## `bulkRegions` (type: `string`):

大量貼上用：一行一個地區，會和上面的欄位自動合併。

## `bedrooms` (type: `integer`):

只留剛好 N 房的物業。留空＝不限。

## `bathrooms` (type: `integer`):

只留剛好 N 個廁所的物業。留空＝不限。

## `schoolNet` (type: `integer`):

只留指定小學校網編號的物業，例如 41（九龍城）、62（元朗）。留空＝不限。

## `sort` (type: `string`):

樓盤列表的排序方式。

## `language` (type: `string`):

地區、屋苑、大廈名稱要用哪種語言回傳。欄位名稱一律是英文 snake\_case。

## `maxItems` (type: `integer`):

本次最多輸出幾筆（所有地區合計）。預設 50、上限 500。

## `proxyConfiguration` (type: `object`):

預設走 Apify residential proxy。美聯對 datacenter 出口回 403，連取存取權杖的頁面都拿不到（實測：直連 200、datacenter 403、residential 200），所以 residential 是這隻 actor 能運作的前提。JSON 回應每筆僅約 4KB，proxy 流量費可忽略。自備 proxy 或本機測試才關掉。

## Actor input object example

```json
{
  "mode": "search",
  "dealType": "buy",
  "regions": [
    "九龍"
  ],
  "sort": "default",
  "language": "zh-hk",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "search",
    "dealType": "buy",
    "regions": [
        "九龍"
    ],
    "language": "zh-hk",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("claude_code_reviewer/midland-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "search",
    "dealType": "buy",
    "regions": ["九龍"],
    "language": "zh-hk",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("claude_code_reviewer/midland-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "search",
  "dealType": "buy",
  "regions": [
    "九龍"
  ],
  "language": "zh-hk",
  "maxItems": 50
}' |
apify call claude_code_reviewer/midland-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,claude_code_reviewer/midland-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/v33kdGCxHjZo3rFnR/builds/GQpaO4aMKqz7E2Njg/openapi.json
