# Xianyu (Goofish) Search / 闲鱼商品搜索 (`gantianca/xianyu-goofish-search`) Actor

Search Xianyu (Goofish) second-hand marketplace products by keyword. Supports price range, sort order, and publish date filters. Returns structured JSON with titles, prices, seller info, and locations.

按关键词搜索闲鱼二手商品。支持价格区间、排序方式、发布时间筛选。返回结构化 JSON 数据，包含商品标题、价格、卖家信息、所在地等。

- **URL**: https://apify.com/gantianca/xianyu-goofish-search.md
- **Developed by:** [时雨 剑](https://apify.com/gantianca) (community)
- **Categories:** E-commerce
- **Stats:** 4 total users, 2 monthly users, 75.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 search-requests

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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## 闲鱼 Search Scraper / Xianyu (Goofish) Search Scraper

<p align="center">
  <strong>闲鱼商品搜索数据采集器 · Xianyu (Goofish) Search API</strong><br/>
  <em>中英双语 · Bilingual (ZH + EN)</em>
</p>

---

### What does this Actor do? 这个 Actor 做什么？

**English:** A **Xianyu (Goofish) search API alternative** that returns structured product data — titles, prices, seller info, location — by calling the official mtop search endpoint.

**中文：** 一个**闲鱼搜索 API 替代方案**，通过调用闲鱼 mtop 搜索接口返回结构化商品数据——商品标题、价格、卖家、所在地等信息。

**Features / 功能：**
- Keyword search / 关键词搜索
- 9 sort modes / 9 种排序方式
- Price range filter / 价格区间筛选
- Auto API signing & token refresh / 自动签名和 token 刷新

**Not supported / 不支持：** Product detail scraping, login, checkout. / 商品详情抓取、用户登录、下单。

[Run on Apify / 立即使用 →](https://console.apify.com/actors/dgjB391geeIjrFO4P)

---

### Why scrape Xianyu? 为什么要采集闲鱼？

| EN | 中文 |
|----|------|
| Second-hand market price trends | 监控二手商品价格趋势 |
| Competitor pricing monitoring | 竞品定价追踪 |
| Product sourcing & arbitrage | 选品参考和套利机会 |
| AI training data (Chinese e-commerce) | AI 训练数据（中文电商） |
| Academic research (C2C marketplace) | 学术研究（C2C市场） |

With Apify platform: scheduling, API access, proxy rotation, monitoring. / 借助 Apify 平台：定时任务、API 访问、代理轮换、用量监控。

---

### What data can it extract? 能提取什么数据？

| Field / 字段 | Type / 类型 | Description / 描述 |
|---------------|-------------|---------------------|
| `title` | string | Product title / 商品标题 |
| `price` | string | Current price / 当前售价 |
| `originalPrice` | string | Original price / 原价 |
| `itemId` | string | Product ID / 商品 ID |
| `sellerNick` | string | Seller nickname / 卖家昵称 |
| `sellerCredit` | string | Seller credit rating / 卖家信用 |
| `location` | string | Item location / 商品所在地 |
| `images` | array | Product image URLs / 商品图片 |
| `createTime` | string | Listing time / 发布时间 |
| `itemUrl` | string | Product detail link / 商品链接 |

---

### How to use 如何使用

**English:**
1. Open the **Input** tab
2. Fill in `keyword` (required), e.g. "iPhone 15"
3. Choose `sort_type` (optional)
4. Set `priceRange` if needed, e.g. `100,600`
5. Click **Start**
6. Download results from **Dataset** (JSON, CSV, Excel)

**中文：**
1. 打开 **Input** 输入选项页
2. 填写 `keyword`（必填），如「小米」
3. 选择排序方式（可选）
4. 需要时填写价格区间（可选），如 `100,600`
5. 点击 **Start** 运行
6. 在 **Dataset** 下载结果

---

### How much does it cost? 如何收费？

**Pay-Per-Event pricing / 按事件计费：**

| Event / 计费事件 | Price / 价格 |
|-------------------|--------------|
| Search request / 搜索请求 | $0.01 / call |
| Search results / 搜索结果 | $1.00 / 1,000 items |

Apify provides **$5 free credits/month** (~5,000 items free). Upgrade for higher volume.

Apify 每月提供 **$5 免费额度**（约 5,000 条免费）。

---

### Input 输入参数

| Parameter / 参数 | Required / 必填 | Description / 说明 |
|-------------------|:--------------:|---------------------|
| `keyword` | 是/Yes | Search keyword / 搜索关键词 |
| `pageNumber` | 否/No | Page number, default 1 / 页码，默认 1 |
| `sort_type` | 否/No | Sort order (see below) / 排序方式（见下） |
| `priceRange` | 否/No | Price range, e.g. `100,600` / 价格区间 |

#### Sort types / 排序方式

| Value / 值 | EN | 中文 |
|------------|-----|------|
| `""` (empty) | Default | 默认综合 |
| `create` | New Listed | 新发布 |
| `modify` | Recently Active | 最近活跃 |
| `reduce` | Price Drop | 新降价 |
| `credit` | Credit | 信用排序 |
| `down_price` | Price High→Low | 价格从高到低 |
| `up_price` | Price Low→High | 价格从低到高 |
| `publishDays:1` | Within 1 Day | 1 天内发布 |
| `publishDays:7` | Within 7 Days | 7 天内发布 |

---

### Output 输出示例

```json
{
  "itemId": "1059910028276",
  "title": "小米14 12+256G 在保 99新",
  "price": "2999.00",
  "originalPrice": "4299.00",
  "sellerNick": "数码玩家小张",
  "sellerCredit": "信用极好",
  "location": "深圳",
  "createTime": "2026-06-10 14:30:00",
  "itemUrl": "https://www.goofish.com/item?id=1059910028276"
}
````

Export formats / 导出格式：JSON, CSV, Excel, HTML.

***

### Tips 使用技巧

- **Proxy / 代理**: This Actor uses built-in residential proxy rotation. No additional configuration needed.
- **Bulk scraping / 批量采集**: Call multiple times with increasing `pageNumber`.
- **Scheduled monitoring / 定时监控**: Set up Apify Schedules for automated price tracking.

***

### FAQ

**Q: Why do I get "被挤爆了" (too crowded) error? / 为什么返回"被挤爆了"？**

A: Xianyu blocks datacenter IPs. This Actor uses residential proxies to avoid this. / 闲鱼限制数据中心 IP，本 Actor 使用住宅代理规避。

**Q: Do I need a Xianyu account? / 需要闲鱼账号吗？**

A: No. Uses public search API only. / 不需要，仅使用公开搜索接口。

**Q: What is the rate limit? / 速率限制是多少？**

A: Recommended ~5 requests/min. The proxy handles rotation automatically. / 建议每分钟约 5 次请求。

**Q: Is this legal? / 是否合规？**

A: Only collects publicly accessible data. No login bypass or private data extraction. Users must comply with Xianyu ToS and applicable laws. **Do NOT use for shop cloning (一键搬家).**

仅采集公开数据，不绕过登录、不提取私密信息。用户有责任遵守闲鱼服务条款。**请勿用于一键搬家等违规用途。**

***

### Disclaimer

> Our Actors are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers.

***

Issues / 问题反馈：[Apify Console](https://console.apify.com/actors/dgjB391geeIjrFO4P)
API access / API 调用：[API Tab](https://console.apify.com/actors/dgjB391geeIjrFO4P/api)

# Actor input Schema

## `keyword` (type: `string`):

Keyword to search on Xianyu (supports Chinese and English) / 在闲鱼上搜索的关键词，支持中英文

## `pageNumber` (type: `string`):

Page number, starting from 1 / 搜索结果页码，从1开始

## `sort_type` (type: `string`):

Product sort order / 商品排序方式

## `priceRange` (type: `string`):

e.g. 100,600 means 100-600 CNY. Leave empty for no limit / 如 100,600 表示100-600元，留空则不限制

## Actor input object example

```json
{
  "pageNumber": "1",
  "sort_type": "",
  "priceRange": ""
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("gantianca/xianyu-goofish-search").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("gantianca/xianyu-goofish-search").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 '{}' |
apify call gantianca/xianyu-goofish-search --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Xianyu (Goofish) Search / 闲鱼商品搜索",
        "description": "Search Xianyu (Goofish) second-hand marketplace products by keyword. Supports price range, sort order, and publish date filters. Returns structured JSON with titles, prices, seller info, and locations.\n\n按关键词搜索闲鱼二手商品。支持价格区间、排序方式、发布时间筛选。返回结构化 JSON 数据，包含商品标题、价格、卖家信息、所在地等。",
        "version": "0.1",
        "x-build-id": "2NVEL1AoMZcs7dnPC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/gantianca~xianyu-goofish-search/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-gantianca-xianyu-goofish-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/gantianca~xianyu-goofish-search/runs": {
            "post": {
                "operationId": "runs-sync-gantianca-xianyu-goofish-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/gantianca~xianyu-goofish-search/run-sync": {
            "post": {
                "operationId": "run-sync-gantianca-xianyu-goofish-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "keyword"
                ],
                "properties": {
                    "keyword": {
                        "title": "Search Keyword / 搜索关键词",
                        "type": "string",
                        "description": "Keyword to search on Xianyu (supports Chinese and English) / 在闲鱼上搜索的关键词，支持中英文"
                    },
                    "pageNumber": {
                        "title": "Page Number / 页码",
                        "type": "string",
                        "description": "Page number, starting from 1 / 搜索结果页码，从1开始",
                        "default": "1"
                    },
                    "sort_type": {
                        "title": "Sort Type / 排序方式",
                        "enum": [
                            "",
                            "reduce",
                            "modify",
                            "create",
                            "credit",
                            "publishDays:1",
                            "publishDays:3",
                            "publishDays:7",
                            "down_price",
                            "up_price"
                        ],
                        "type": "string",
                        "description": "Product sort order / 商品排序方式",
                        "default": ""
                    },
                    "priceRange": {
                        "title": "Price Range / 价格区间",
                        "type": "string",
                        "description": "e.g. 100,600 means 100-600 CNY. Leave empty for no limit / 如 100,600 表示100-600元，留空则不限制",
                        "default": ""
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
