# PChome 爬蟲｜商品、價格、庫存、評分一鍵匯出（免 API） (`claude_code_reviewer/pchome-scraper`) Actor

免登入、免 token 抓 PChome 24h 商品：關鍵字搜尋列表與商品詳情，含標題、價格、原價、庫存、評分與圖片，輸出 JSON／CSV／Excel。支援批量關鍵字與商品 ID／網址，電商比價、選品、庫存監控必備。

- **URL**: https://apify.com/claude\_code\_reviewer/pchome-scraper.md
- **Developed by:** [Chad](https://apify.com/claude_code_reviewer) (community)
- **Categories:** E-commerce, Developer tools, Agents
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## 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

## PChome 24h 商品爬蟲｜搜尋、價格、庫存一鍵下載（免 API、免登入）

一個 Actor 搞定 PChome 24h 商城兩種你會用到的抓取模式：**關鍵字搜尋**（拿商品列表、品牌、評分）與**商品詳情**（依 ID/網址拿即時價格、庫存）。不需要登入、不需要 API token、批量貼上上百個關鍵字或商品 ID 都吃得下。全程走 PChome 官方 JSON 端點，不開瀏覽器，速度快、成本低。

給誰用的：做比價網站的、追蹤特定商品價格波動的、寫市場調查報告的、跑電商數據分析的、論文需要資料集的、自己寫 side project 的工程師。

***

### 能抓到什麼

每一筆商品都會拿到下面這些欄位（缺值一律回 `null`，不會少欄位）：

| 欄位              | 說明                                  | 範例                                              | 可用模式  |
| ----------------- | ------------------------------------- | ------------------------------------------------- | --------- |
| `product_id`      | PChome 商品 ID                        | `DCANNU-A900ARQAX`                                | 兩者      |
| `title`           | 商品名稱                              | `Logitech 羅技 M331 靜音無線滑鼠`                 | 兩者      |
| `brand`           | 品牌                                  | `Logitech`                                        | search 只 |
| `price`           | 目前售價（NT$）                       | `590`                                             | 兩者      |
| `original_price`  | 原價（NT$）                           | `790`                                             | 兩者      |
| `discount_pct`    | 折扣百分比                            | `25`                                              | 兩者      |
| `category`        | 分類名稱（v1.0 一律 null）            | —                                                 | —         |
| `category_path`   | 分類代碼路徑                          | `DCAA`                                            | search 只 |
| `rating`          | 評分（0-5）                           | `4.5`                                             | search 只 |
| `review_count`    | 評論數                                | `312`                                             | search 只 |
| `stock_status`    | 庫存狀態                              | `in_stock`、`out_of_stock`                        | detail 只 |
| `is_24h_delivery` | 是否 24h 到貨                         | `true`                                            | search 只 |
| `promo`           | 促銷文案（v1.0 一律 null）            | —                                                 | —         |
| `image_urls`      | 商品圖網址陣列                        | `["https://.../pic.jpg"]`                         | 兩者      |
| `product_url`     | 商品網址                              | `https://24h.pchome.com.tw/prod/DCANNU-A900ARQAX` | 兩者      |
| `source_mode`     | 這筆從哪個模式來的                    | `search`、`detail`                                | 兩者      |
| `source_query`    | 抓取時用的查詢條件（關鍵字或商品 ID） | `羅技滑鼠`                                        | 兩者      |
| `scraped_at`      | 抓取當下時間（ISO 8601）              | `2026-07-03T05:23:28.617Z`                        | 兩者      |

**重要：`brand`、`rating`、`review_count`、`category_path`、`is_24h_delivery` 只有搜尋模式會有值，詳情模式一律 `null`**（PChome 商品頁 API 本身不回這些欄位）。`category` 與 `promo` 在 v1.0 一律 `null`（分類名稱查表為 v1.1 功能）。反過來，**`stock_status` 只有詳情模式才會有值**，搜尋模式一律 `null`（搜尋列表 API 不含即時庫存）。

***

### 兩種模式一個爬蟲

| 模式          | 幹嘛用的                                     | 計費事件                 | 單價   |
| ------------- | -------------------------------------------- | ------------------------ | ------ |
| 🔎 **search** | 關鍵字搜尋，拿商品列表（含品牌、評分、分類） | `search-listing`（每筆） | $0.002 |
| 📦 **detail** | 依商品 ID/網址抓單一商品的即時價格、庫存     | `product-detail`（每筆） | $0.008 |

不管跑哪個模式，每次 Run 啟動都會額外收一次性的 `apify-actor-start` 費用 **$0.005**。所有計費都在資料成功寫入 dataset **之後**才會收，Run 結束時 log 會印出 `total_items / charged / skipped` 讓你對帳。

一次跑一個 mode，從 Apify Console 的下拉選單選就好。

***

### 輸入欄位

| 欄位          | 型別     |         必填          |    預設     | 說明                                                                                                                                                                |
| ------------- | -------- | :-------------------: | :---------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`        | enum     |        建議填         |  `search`   | `search`（關鍵字搜尋）/ `detail`（商品詳情）擇一。                                                                                                                  |
| `keywords`    | string\[] |   `search` 模式必填   |      —      | 搜尋關鍵字，一個概念一個關鍵字最準。單次最多 **50** 個。                                                                                                            |
| `sort`        | enum     |         選填          | `relevance` | `relevance`（相關度）/ `sales`（熱銷）/ `price_asc`（價格低→高）/ `price_desc`（價格高→低），只對 `search` 模式有效。                                               |
| `priceMin`    | integer  |         選填          |      —      | 只留售價 ≥ 此金額的商品（NT$，僅 `search` 模式）。留空表示不限。                                                                                                    |
| `priceMax`    | integer  |         選填          |      —      | 只留售價 ≤ 此金額的商品（NT$，僅 `search` 模式）。留空表示不限。                                                                                                    |
| `productIds`  | string\[] | `detail` 模式必填其一 |      —      | PChome 商品 ID，例如 `DCANNU-A900ARQAX`（商品網址 `/prod/` 後面那段）。單次最多 **100** 個。                                                                        |
| `productUrls` | string\[] | `detail` 模式必填其一 |      —      | PChome 24h 商品完整網址，例如 `https://24h.pchome.com.tw/prod/DCANNU-A900ARQAX`，會自動抽出 ID。單次最多 **100** 個。                                               |
| `bulkInput`   | string   |         選填          |      —      | **一行一個**，按 Enter 換行，不要加引號或逗號。搜尋模式當關鍵字、詳情模式當商品 ID/網址，執行時自動併入上面對應欄位。從 Google Sheet / Excel 複製一整欄貼進來最快。 |
| `maxItems`    | integer  |         選填          |    `50`     | 每個關鍵字最多抓幾筆（`search` 模式，1-500）。`detail` 模式不受此限，依 ID/網址數量而定。                                                                           |

***

### 範例

**🔎 基本關鍵字搜尋**

```json
{
    "mode": "search",
    "keywords": ["羅技滑鼠"],
    "sort": "relevance",
    "maxItems": 15
}
```

**💰 價格區間 + 依熱銷排序**

```json
{
    "mode": "search",
    "keywords": ["機械鍵盤"],
    "sort": "sales",
    "priceMin": 1000,
    "priceMax": 3000,
    "maxItems": 30
}
```

**📦 依商品 ID 抓詳情（含庫存）**

```json
{
    "mode": "detail",
    "productIds": ["DCANNU-A900ARQAX", "DSAR07-A900G00I7"]
}
```

***

### 幾個要注意的地方

- **只抓公開資料**。不需要登入、不需要 PChome 帳號，也不會存取任何需要驗證才看得到的內容。
- **不用登入 / 不用 API token**。填好 input 就能跑，沒有任何金鑰要設定。
- **`detail` 模式不含品牌 / 評分**。PChome 商品詳情 API 本身沒有這些欄位，要拿品牌、評分、評論數請改用 `search` 模式（見上方欄位表格）。
- **對電商站友善**。每個 domain 併發數 ≤5，遇到失敗會用指數退避重試最多 3 次，不會對 PChome 伺服器狂發請求。
- **同一商品若命中多個關鍵字，會以不同 `source_query` 各出一列（依查詢計費）**。例如「羅技滑鼠」跟「無線滑鼠」兩個關鍵字都搜到同一顆滑鼠，資料會出現兩筆，`source_query` 分別是這兩個關鍵字，各自計費一次 `search-listing`。
- **評論功能（reviews）規劃於後續版本**，目前版本不抓逐則評論內容，只有 `search` 模式的彙總 `rating` / `review_count`。

***

### 常見問題

**Q: 商品 ID 去哪找？**
打開任一 PChome 商品頁，網址 `/prod/` 後面那一段就是（例如 `https://24h.pchome.com.tw/prod/DCANNU-A900ARQAX` 的 ID 是 `DCANNU-A900ARQAX`）。也可以直接把整串商品網址貼進 `productUrls`，爬蟲會自動抽出 ID。

**Q: 為什麼詳情模式沒有評分？**
PChome 的商品詳情 API 本身就不回品牌、評分、評論數這幾個欄位，只有搜尋列表 API 才有。想拿這些資訊請用 `search` 模式搜同一個商品名稱或關鍵字。

**Q: 費用怎麼算？**
每次 Run 啟動收一次 `apify-actor-start`（$0.005）；`search` 模式每筆商品列表收 `search-listing`（$0.002）；`detail` 模式每筆商品詳情收 `product-detail`（$0.008）。都是資料成功寫入 dataset 後才收費，Run log 會印出實際收費筆數。

**Q: 抓不到資料怎麼辦？**
先確認關鍵字有沒有打錯字、換個更常見的關鍵字試試；`detail` 模式則確認商品 ID 或網址是否正確、商品是否已下架。爬蟲連續 5 次拿不到新資料就會自己停並在 log 寫原因，不會空轉燒錢。

**Q: `category_path` 是什麼？**
這是 PChome 內部的分類**代碼**（例如 `DCAA`），不是分類名稱。代碼對照分類名稱的功能規劃在 v1.1 版本加入。

**Q: `is_24h_delivery` 準嗎？**
這個欄位反映的是「是否為 PChome 自營商品」，PChome 自營商品通常就是 24h 到貨，準確度跟 PChome 官網顯示的一致，但仍以下單當下頁面標示為準。

***

### 部署

```bash
apify login              # 首次:貼上 Apify token(不會寫進 repo)
apify push               # 建置並上傳到 Apify Store
```

上架後在 Apify Console 的 Monetization 設定 PPE 事件單價:
`apify-actor-start` $0.005、`search-listing` $0.002、`product-detail` $0.008。

***

### 📚 延伸教學與工具

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

- 📖 教學：[用 Apify + n8n 自動追蹤 PChome／momo／露天商品降價，不用每天手動比價](https://aisocialapi.com/zh-hant/learn/pchome-momo-ruten-price-drop-alerts/?utm_source=apify\&utm_medium=readme\&utm_campaign=pchome-scraper)
- 📊 原創資料：[站台涵蓋表：模式、欄位與定價](https://aisocialapi.com/zh-hant/coverage/?utm_source=apify\&utm_medium=readme\&utm_campaign=pchome-scraper) — 40 個站台各有哪些模式、實際回傳哪些欄位、每筆多少錢，全部從 actor 自己的 schema 生成
- 🛠 免費工具：[Apify 成本試算](https://aisocialapi.com/zh-hant/tools/apify-cost/?utm_source=apify\&utm_medium=readme\&utm_campaign=pchome-scraper) · [論壇輿情快查](https://aisocialapi.com/zh-hant/tools/forum-sentiment/?utm_source=apify\&utm_medium=readme\&utm_campaign=pchome-scraper)
- 🤝 不想自己跑？[我幫你每天跑](https://aisocialapi.com/zh-hant/monitor/?utm_source=apify\&utm_medium=readme\&utm_campaign=pchome-scraper)——排程好每天送進你的 Google Sheet 或 Slack，每月 US$299 起。

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

***

### 免責聲明

本爬蟲只收集 PChome 24h 商城**公開可見**的商品資料，資料僅供研究與個人用途使用，不用於任何未經授權的商業轉售。使用前請自行確認符合 PChome 服務條款與當地法規。對於資料的正確性、即時性或完整性，本 Actor 不做任何保證，商品價格與庫存請以 PChome 官網當下顯示為準。

***

*PChome 爬蟲、PChome API、比價、價格追蹤、電商數據、市場調查、PChome 24h 商品資料*

# Actor input Schema

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

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

## `keywords` (type: `array`):

搜尋模式的關鍵字。例如:羅技滑鼠、機械鍵盤、氣泡水機。一個概念一個關鍵字最準。

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

搜尋結果排序,只有搜尋模式吃這個設定。

## `priceMin` (type: `integer`):

只留售價 ≥ 此金額的商品(搜尋模式)。留空表示不限。

## `priceMax` (type: `integer`):

只留售價 ≤ 此金額的商品(搜尋模式)。留空表示不限。

## `productIds` (type: `array`):

PChome 商品 ID,例如 DCANNU-A900ARQAX(在商品網址 /prod/ 後面那段)。詳情模式用這個。

## `productUrls` (type: `array`):

PChome 24h 商品完整網址,例如 https://24h.pchome.com.tw/prod/DCANNU-A900ARQAX。會自動抽出 ID。

## `bulkInput` (type: `string`):

**一行一個**,按 Enter 換行,不要加引號或逗號。搜尋模式當關鍵字、詳情模式當商品 ID/網址,執行時自動併入上面對應欄位。從 Google Sheet / Excel 複製一整欄貼進來最快。

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

每個關鍵字最多抓幾筆(搜尋模式)。越多費用越高。詳情模式不受此限(依 ID 數量)。

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

PChome 對 datacenter 請求友善,預設不用 proxy 即可運作。只有大量抓取遇到被擋 (429) 時才建議開啟。

## Actor input object example

```json
{
  "mode": "search",
  "keywords": [
    "羅技滑鼠"
  ],
  "sort": "relevance",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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",
    "keywords": [
        "羅技滑鼠"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("claude_code_reviewer/pchome-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",
    "keywords": ["羅技滑鼠"],
}

# Run the Actor and wait for it to finish
run = client.actor("claude_code_reviewer/pchome-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",
  "keywords": [
    "羅技滑鼠"
  ]
}' |
apify call claude_code_reviewer/pchome-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,claude_code_reviewer/pchome-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/4itLUnTdm8ZIxSDdF/builds/PxaYPxRoowAlXcY6k/openapi.json
