# 露天拍賣爬蟲｜商品、價格、二手行情、銷量一鍵匯出（免 API） (`claude_code_reviewer/ruten-scraper`) Actor

免登入抓露天拍賣商品：關鍵字搜尋列表與商品詳情，含價格範圍、庫存、銷售數與賣家 ID，輸出 JSON／CSV／Excel。二手行情追蹤、賣家分析、選品必備。

- **URL**: https://apify.com/claude\_code\_reviewer/ruten-scraper.md
- **Developed by:** [Chad](https://apify.com/claude_code_reviewer) (community)
- **Categories:** E-commerce, Agents, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 4 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/platform/actors/running/actors-in-store#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

## 露天拍賣商品爬蟲｜搜尋、價格、二手行情追蹤（免 API、免登入）

一個 Actor 搞定露天拍賣（Ruten）兩種你會用到的抓取模式：**關鍵字搜尋**（拿商品列表、即時價格、銷售量）與**商品詳情**（依 ID/網址拿單一商品的完整資料）。不需要登入、不需要 API token，批量貼上上百個關鍵字或商品編號都吃得下。全程走露天官方 rtapi 半公開 JSON 端點，不開瀏覽器，速度快、成本低。

給誰用的：追蹤二手行情波動的、做比價 / 市場調查的、電商數據分析的、論文需要資料集的、自己寫 side project 的工程師。

***

### 能抓到什麼

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

| 欄位               | 說明                                   | 範例                                                |
| ------------------ | -------------------------------------- | --------------------------------------------------- |
| `item_id`          | 露天商品編號                           | `21311212469710`                                    |
| `title`            | 商品名稱                               | `羅技 M331 靜音無線滑鼠`                            |
| `price`            | 售價下限（NT$）                        | `269`                                               |
| `price_range`      | **價格範圍**，有分級才會是區間         | `269` 或 `269-500`                                  |
| `currency`         | 幣別                                   | `TWD`                                               |
| `condition`        | 商品新舊狀況（**v1.0 一律 `null`**）   | —                                                   |
| `stock`            | **庫存**，即時值                       | `12`                                                |
| `sold_count`       | **銷售數**，累計成交件數               | `358`                                               |
| `rating_count`     | 評價數（**v1.0 一律 `null`**）         | —                                                   |
| `seller_id`        | 賣家 ID                                | `abc123seller`                                      |
| `seller_name`      | 賣家名稱（**v1.0 一律 `null`**）       | —                                                   |
| `seller_rating`    | 賣家評等（**v1.0 一律 `null`**）       | —                                                   |
| `location`         | 商品所在地（**v1.0 一律 `null`**）     | —                                                   |
| `shipping_options` | 運送方式（**v1.0 一律空陣列 `[]`**）   | —                                                   |
| `image_urls`       | 商品圖網址陣列                         | `["https://gcs.rimg.com.tw/..."]`                   |
| `item_url`         | 商品網址                               | `https://www.ruten.com.tw/item/show?21311212469710` |
| `source_mode`      | 這筆從哪個模式來的                     | `search`、`item`                                    |
| `source_query`     | 抓取時用的查詢條件（關鍵字或商品編號） | `羅技滑鼠`                                          |
| `scraped_at`       | 抓取當下時間（ISO 8601）               | `2026-07-04T05:23:28.617Z`                          |

**這隻爬蟲的差異化在 `sold_count`（銷售數）、`price_range`（價格範圍）、`stock`（庫存）三個欄位**——都是即時值，抓取當下的實際狀態，適合拿來做二手行情觀察（見下方「幾個要注意的地方」）。

**重要：`condition`、`rating_count`、`seller_name`、`seller_rating`、`location` 在 v1.0 一律 `null`，`shipping_options` 一律空陣列 `[]`**。露天商品批次端點（rtapi prod v2）本身不回這些欄位；賣家詳細資料規劃在 v1.1 的「賣場模式」加入（見下）。

***

### 兩種模式一個爬蟲

| 模式          | 幹嘛用的                                       | 計費事件                 | 單價   |
| ------------- | ---------------------------------------------- | ------------------------ | ------ |
| 🔎 **search** | 關鍵字搜尋，拿商品列表（含價格、庫存、銷售數） | `search-listing`（每筆） | $0.002 |
| 📦 **item**   | 依商品編號/網址抓單一商品的完整資料            | `product-detail`（每筆） | $0.008 |

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

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

> **賣場（seller）模式規劃於 v1.1**，目前版本（v1.0）只支援 `search` 與 `item` 兩種模式，尚未支援依賣家帳號抓整間賣場的商品列表。

***

### 輸入欄位

| 欄位                 | 型別     |        必填         |    預設     | 說明                                                                                                                                                                 |
| -------------------- | -------- | :-----------------: | :---------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`               | enum     |       建議填        |  `search`   | `search`（關鍵字搜尋）/ `item`（商品詳情）擇一。                                                                                                                     |
| `keywords`           | string\[] |  `search` 模式必填  |      —      | 搜尋關鍵字，一個概念一個關鍵字最準。單次最多 **50** 個。                                                                                                             |
| `itemIds`            | string\[] | `item` 模式必填其一 |      —      | 露天商品編號，例如 `21311212469710`（在商品網址 `/item/show?` 後面那串數字）。單次最多 **100** 個。                                                                  |
| `itemUrls`           | string\[] | `item` 模式必填其一 |      —      | 露天商品完整網址，例如 `https://www.ruten.com.tw/item/show?21311212469710`，會自動抽出編號。單次最多 **100** 個。                                                    |
| `bulkInput`          | string   |        選填         |      —      | **一行一個**，按 Enter 換行，不要加引號或逗號。搜尋模式當關鍵字、詳情模式當商品編號/網址，執行時自動併入上面對應欄位。從 Google Sheet / Excel 複製一整欄貼進來最快。 |
| `priceMin`           | integer  |        選填         |      —      | 只留售價 ≥ 此金額的商品（NT$，僅 `search` 模式）。留空表示不限。                                                                                                     |
| `priceMax`           | integer  |        選填         |      —      | 只留售價 ≤ 此金額的商品（NT$，僅 `search` 模式）。留空表示不限。                                                                                                     |
| `maxItems`           | integer  |        選填         |    `50`     | 每個關鍵字最多抓幾筆（`search` 模式，1-500）。`item` 模式不受此限，依編號/網址數量而定。                                                                             |
| `sort`               | enum     |        選填         | `relevance` | 搜尋結果排序，目前只驗證過 `relevance`（相關度），其他排序值尚未支援。                                                                                               |
| `proxyConfiguration` | object   |        選填         |    關閉     | 進階選項。露天對一般請求友善，預設不用 proxy 即可運作，遇到大量抓取被擋（429）才建議開啟。                                                                           |

***

### 範例

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

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

**📦 依商品編號抓詳情**

```json
{
    "mode": "item",
    "itemIds": ["21311212469710", "22452509453494", "22319680297043"]
}
```

**💰 價格區間搜尋（篩選二手行情帶）**

```json
{
    "mode": "search",
    "keywords": ["PlayStation 5"],
    "priceMin": 8000,
    "priceMax": 12000,
    "maxItems": 50
}
```

***

### 幾個要注意的地方

- **只抓公開資料**。不需要登入、不需要露天帳號，也不會存取任何需要驗證才看得到的內容。
- **不用登入 / 不用 API token**。填好 input 就能跑，沒有任何金鑰要設定。
- **走露天 rtapi 半公開 JSON 端點**（`search/v3`、`prod/v2`），不是官方公開文件化的 API，但穩定可用，不開瀏覽器，成本低。
- **對露天伺服器友善**。每個 domain 併發數 ≤5，遇到失敗會用指數退避重試最多 3 次。
- **跨頁 / 跨批自動去重，不會重複計費**。同一商品若因搜尋分頁重疊而出現在兩批裡，只會被 push 與收費一次。
- **連續 5 頁搜尋拿不到新資料，該關鍵字會自動停止**並在 log 寫下原因，不會空轉燒錢。
- **差異化玩法：二手行情追蹤**。`sold_count`（銷售數）、`price_range`（價格範圍）、`stock`（庫存）都是抓取當下的即時值，用排程（Apify 的 Schedule）定期對同一組關鍵字跑 `search` 模式，把每次結果疊起來，就能畫出價格走勢、銷量曲線，觀察某類二手商品的行情變化。
- **賣場模式（依賣家帳號抓整間賣場）規劃於 v1.1**，目前版本不支援。

***

### 常見問題

**Q: 商品編號去哪找？**
打開任一露天商品頁，網址 `/item/show?` 後面那一串數字就是（例如 `https://www.ruten.com.tw/item/show?21311212469710` 的編號是 `21311212469710`）。也可以直接把整串商品網址貼進 `itemUrls`，爬蟲會自動抽出編號。

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

**Q: `sold_count`、`stock` 準嗎？**
兩者都直接來自露天 rtapi 商品端點的即時值，跟商品頁當下顯示的數字一致，但露天後台可能有些微延遲同步，仍以商品頁當下顯示為準。

**Q: 為什麼沒有賣家評價 / 商品新舊（`condition`）？**
露天目前使用的 rtapi 商品批次端點（`prod/v2`）本身不回這些欄位，只有 `item_id`、`title`、`price` 相關的基本資料與少量賣家 ID。賣家評價、評等、商品新舊狀況等欄位規劃在 v1.1 的「賣場模式」中另外串接。

**Q: 二手行情怎麼用？**
用 Apify 的 Schedule 功能，設定固定間隔（例如每天一次）對同一組關鍵字跑 `search` 模式，把每次的 dataset 疊起來看 `price`、`price_range`、`sold_count` 隨時間的變化，就能大致抓出某類二手商品的價格走勢與熱銷程度。

***

### 部署

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

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

***

### 免責聲明

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

***

*露天拍賣 爬蟲、露天 API、二手價格、行情追蹤、賣場監控、C2C 電商數據*

# Actor input Schema

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

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

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

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

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

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

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

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

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

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

## `itemIds` (type: `array`):

露天商品編號,例如 21311212469710(在商品網址最後一段)。詳情模式用這個。

## `itemUrls` (type: `array`):

露天商品完整網址,例如 https://www.ruten.com.tw/item/show?21311212469710。會自動抽出編號。

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

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

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

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

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

露天對 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/ruten-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/ruten-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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/ruten-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=claude_code_reviewer/ruten-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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