goofish-xianyu-api 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- goofish_xianyu_api-1.0.0/LICENSE +21 -0
- goofish_xianyu_api-1.0.0/PKG-INFO +189 -0
- goofish_xianyu_api-1.0.0/README.md +157 -0
- goofish_xianyu_api-1.0.0/pyproject.toml +69 -0
- goofish_xianyu_api-1.0.0/setup.cfg +4 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api/__init__.py +70 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api/cli.py +273 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api/client.py +1129 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api/helpers.py +841 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api/py.typed +1 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api.egg-info/PKG-INFO +189 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api.egg-info/SOURCES.txt +15 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api.egg-info/dependency_links.txt +1 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api.egg-info/entry_points.txt +3 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api.egg-info/requires.txt +6 -0
- goofish_xianyu_api-1.0.0/src/goofish_xianyu_api.egg-info/top_level.txt +1 -0
- goofish_xianyu_api-1.0.0/tests/test_client.py +580 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UnitBytes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: goofish-xianyu-api
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Cookie-free Python SDK & CLI for Goofish (Xianyu / 闲鱼): secondhand & luxury deal search, listing details, seller inventory, buyer reviews, CNY resale discount math, and Zhima Credit trust scoring.
|
|
5
|
+
Author-email: UnitBytes <contact@unitbytes.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://unitbytes.com/actors/goofish-xianyu-seller-scraper/
|
|
8
|
+
Project-URL: Documentation, https://unitbytes.com/actors/goofish-xianyu-seller-scraper/
|
|
9
|
+
Project-URL: Apify Store, https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk
|
|
10
|
+
Keywords: goofish,xianyu,idlefish,secondhand,recommerce,resale,luxury-authentication,zhima-credit,scraper,apify
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
21
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: apify
|
|
28
|
+
Requires-Dist: apify-client>=1.7.0; extra == "apify"
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# goofish-xianyu-api — Goofish (Xianyu / 闲鱼) Search, Seller Inventory & Reviews Python SDK
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/goofish-xianyu-api/)
|
|
38
|
+
[](https://www.python.org/)
|
|
39
|
+
[](https://opensource.org/licenses/MIT)
|
|
40
|
+
|
|
41
|
+
> **Disclaimer:** Independent integration powered by UnitBytes; not affiliated with or endorsed by Alibaba Group, 1688.com, or Goofish/Xianyu.
|
|
42
|
+
|
|
43
|
+
**`goofish-xianyu-api`** is a typed Python SDK and CLI (`goofish-xianyu` / `goofish-scrape`) for **Goofish / Xianyu (`闲鱼`)** secondhand & luxury resale intelligence — including keyword search, `m.tb.cn` mobile share-link resolution, listing details, seller storefront inventory (`onsale` & `sold`), buyer reviews, CNY-to-USD markdown math, and **Zhima Credit (`芝麻信用`)** seller trust scoring — with **zero Taobao/Alipay cookies required**.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Why Use `goofish-xianyu-api`?
|
|
48
|
+
|
|
49
|
+
- **Zero Login / Zero Cookie Churn / Zero Mandatory Dependencies** — Pure Python stdlib HTTP client (`0` required third-party packages); no +86 SMS verification, Alipay QR login, or local proxy rotation to maintain.
|
|
50
|
+
- **Multi-Provider Cloud Routing (`apify` • `unitbytes` • `rapidapi`)** — Auto-detects `APIFY_TOKEN` (warm Apify Standby HTTP + batch fallback), `UNITBYTES_API_KEY` (`https://api.unitbytes.com/v1/goofish/*`), or `RAPIDAPI_KEY` (`https://goofish-xianyu-marketplace-and-seller-api.p.rapidapi.com/v1/goofish/*`) with zero code changes.
|
|
51
|
+
- **Multi-Keyword Watchlist Sniper (`search_many` + `only_new`)** — Deduplicate across multiple keywords by canonical `itemId` and persist seen listings in an atomic local JSON state file so cron jobs alert only on newly listed deals.
|
|
52
|
+
- **Offline English → Xianyu Slang Glossary (`0` LLM Calls)** — Translate English product terms, ACG *guzi* merch (`badge` → `吧唧`, `plush` → `棉花娃娃`, `acrylic stand` → `立牌`), and Xianyu condition shorthand (`box and papers` → `箱说全`, `unopened` → `全新未拆封`) offline while preserving model numbers (`"Sony A7M4 mirrorless camera"` → `"索尼 A7M4 微单相机"`).
|
|
53
|
+
- **Cross-Border Proxy-Agent Links Built In** — Generate ready-to-open **Superbuy, AllChinaBuy, Sugargoo, CSSBuy, and Basetao** order URLs (`build_proxy_agent_links`) alongside CNY-to-USD markdown math (`analyze_resale_pricing`) and 0–100 **Zhima Credit (`芝麻信用`)** seller trust scoring (`assess_seller_trust`).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Quickstart
|
|
58
|
+
|
|
59
|
+
### 1. Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install goofish-xianyu-api
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. Configure Your Free Starter API Token
|
|
66
|
+
|
|
67
|
+
Create a free Apify account (**\$5/month recurring platform credit included — no credit card required**) and copy your `APIFY_TOKEN`:
|
|
68
|
+
|
|
69
|
+
- **[Get a Free Apify API Token (\$5/mo credit included)](https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk)**
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
export APIFY_TOKEN="apify_api_YOUR_TOKEN"
|
|
73
|
+
# Or use UnitBytes Direct Cloud API / RapidAPI with zero code changes:
|
|
74
|
+
# export UNITBYTES_API_KEY="ub_live_YOUR_KEY"
|
|
75
|
+
# export RAPIDAPI_KEY="YOUR_RAPIDAPI_KEY"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Zero-Login Live Keyword Search, Watchlist Deal Sniper & Seller Zhima Audit
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from goofish_xianyu_api import (
|
|
82
|
+
GoofishClient,
|
|
83
|
+
analyze_resale_pricing,
|
|
84
|
+
assess_seller_trust,
|
|
85
|
+
build_proxy_agent_links,
|
|
86
|
+
translate_keyword,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
client = GoofishClient() # Reads APIFY_TOKEN automatically
|
|
90
|
+
|
|
91
|
+
# 1) Offline English -> Simplified Chinese Xianyu slang translation (0 network calls)
|
|
92
|
+
print(translate_keyword("Sony A7M4 mirrorless camera box and papers"))
|
|
93
|
+
# -> "索尼 A7M4 微单相机 箱说全"
|
|
94
|
+
print(translate_keyword("Genshin Impact badge unopened"))
|
|
95
|
+
# -> "原神 吧唧 全新未拆封"
|
|
96
|
+
|
|
97
|
+
# 2) Multi-keyword watchlist sniper with cross-keyword itemId dedup & persistent state
|
|
98
|
+
new_deals = client.search_many(
|
|
99
|
+
["Sony A7C2 mirrorless", "Fujifilm X100VI box and papers", "Nintendo Switch OLED"],
|
|
100
|
+
max_items=45, # Auto-paginates warm Standby pages (>30 items)
|
|
101
|
+
translate_keywords=True, # Translates English terms into Chinese Xianyu slang
|
|
102
|
+
personal_only=True, # Filter out commercial storefronts (个人闲置)
|
|
103
|
+
free_shipping=True,
|
|
104
|
+
price_min=1000,
|
|
105
|
+
price_max=13500,
|
|
106
|
+
sort_by="newest",
|
|
107
|
+
only_new=True, # Emit only unseen itemIds across cron runs
|
|
108
|
+
state_file="watchlist_state.json",
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
for item in new_deals[:5]:
|
|
112
|
+
pricing = analyze_resale_pricing(item, cny_to_usd=0.138)
|
|
113
|
+
agents = build_proxy_agent_links(item)
|
|
114
|
+
print(
|
|
115
|
+
f"[{item.get('matchedKeyword')}] {item['title']} -> "
|
|
116
|
+
f"¥{pricing.price_cny} (${pricing.price_usd}, -{pricing.discount_pct}%)"
|
|
117
|
+
)
|
|
118
|
+
print(f" Superbuy: {agents.superbuy}")
|
|
119
|
+
print(f" AllChinaBuy: {agents.allchinabuy}")
|
|
120
|
+
|
|
121
|
+
# 3) Resolve a raw Xianyu mobile share snippet or numeric item ID
|
|
122
|
+
detail = client.get_item_detail("【闲鱼】https://m.tb.cn/h.5xyz123 点击链接直接打开")
|
|
123
|
+
|
|
124
|
+
# 4) Audit seller Zhima Credit, KYC verification badges & negative buyer feedback
|
|
125
|
+
profile = client.get_seller_profile("2214891234567")
|
|
126
|
+
trust = assess_seller_trust(profile)
|
|
127
|
+
print(f"Trust Score: {trust.trust_score}/100 | Zhima: {trust.zhima_tier} | Risk: {trust.risk_level}")
|
|
128
|
+
|
|
129
|
+
sold_comps = client.get_seller_items("2214891234567", status="sold", max_items=20)
|
|
130
|
+
neg_reviews = client.get_seller_reviews("2214891234567", review_filter="negative_only", max_reviews=20)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Command-Line Interface (`goofish-xianyu` / `goofish-scrape`)
|
|
136
|
+
|
|
137
|
+
Export Goofish resale listings (enriched automatically with `resaleSummary` and `proxyAgentLinks`), seller profiles, and reviews to `json`, `jsonl`, or `csv`:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Multi-keyword English -> Chinese watchlist sniper (persists unseen IDs in seen_deals.json)
|
|
141
|
+
goofish-xianyu --format jsonl search \
|
|
142
|
+
--keywords "Sony A7C2 mirrorless" "Pokemon card unopened" \
|
|
143
|
+
--translate \
|
|
144
|
+
--personal-only \
|
|
145
|
+
--max-items 40 \
|
|
146
|
+
--only-new seen_deals.json
|
|
147
|
+
|
|
148
|
+
# Search personal sellers and export USD markdowns + Superbuy/AllChinaBuy columns to CSV
|
|
149
|
+
goofish-xianyu --format csv --output deals.csv search "爱马仕 picotin" --personal-only --max-items 20
|
|
150
|
+
|
|
151
|
+
# Inspect a single listing (supports raw m.tb.cn share links)
|
|
152
|
+
goofish-xianyu --format json item "https://www.goofish.com/item?id=837465918273"
|
|
153
|
+
|
|
154
|
+
# Audit a seller's Zhima Credit + trust score
|
|
155
|
+
goofish-xianyu --format json seller 2214891234567 --include-items --include-reviews
|
|
156
|
+
|
|
157
|
+
# Export a seller's historical sold comps as JSONL
|
|
158
|
+
goofish-scrape --format jsonl seller-items 2214891234567 --status sold --max-items 20
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Direct Apify Actor JSON Input Compatibility
|
|
164
|
+
|
|
165
|
+
When triggering [`unitbytes/goofish-xianyu-search-scraper`](https://apify.com/unitbytes/goofish-xianyu-search-scraper?fpr=939u3w&fp_sid=pypi_sdk) directly via REST, n8n, or `prefer_standby=False`, pass multi-keyword queries as a comma-separated string in `keyword` (`"keyword": "索尼 A7C2, 富士 X100VI, Switch OLED"`). `GoofishClient.search_many(..., prefer_standby=False)` formats this automatically.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Upstream Actors & Pricing
|
|
170
|
+
|
|
171
|
+
| Capability | Apify Actor Slug | Landing Page | Pay-Per-Event Pricing |
|
|
172
|
+
| :--- | :--- | :--- | :--- |
|
|
173
|
+
| Keyword Search & Listing Detail | [`unitbytes/goofish-xianyu-search-scraper`](https://apify.com/unitbytes/goofish-xianyu-search-scraper?fpr=939u3w&fp_sid=pypi_sdk) | [unitbytes.com/actors/goofish-xianyu-search-scraper](https://unitbytes.com/actors/goofish-xianyu-search-scraper/) | \$0.002 search / \$0.003 detail |
|
|
174
|
+
| Seller Profile, Inventory (`onsale`/`sold`) & Reviews | [`unitbytes/goofish-scraper`](https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk) | [unitbytes.com/actors/goofish-xianyu-seller-scraper](https://unitbytes.com/actors/goofish-xianyu-seller-scraper/) | \$0.004 profile / \$0.0035 item / \$0.001 review |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Realistic Scope & Upstream Boundaries
|
|
179
|
+
|
|
180
|
+
- **Works Reliably Without Login:** Public Goofish keyword search, CNY price & personal-seller filters, `m.tb.cn` share-link resolution, full item descriptions & HD galleries, seller Zhima Credit tier (`极好`/`优秀`/`良好`), KYC verification badges (`实人认证`/`实名认证`), active & sold storefront inventory, and buyer feedback ratings.
|
|
181
|
+
- **Upstream Platform Boundaries:** Private buyer-seller chat messages, direct Alipay phone/account identifiers, and order checkout actions require an authenticated personal Goofish mobile app session and are outside the scope of public guest data extraction.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Legal & Compliance
|
|
186
|
+
|
|
187
|
+
- Extracts **publicly available marketplace listing & seller reputation metadata** only.
|
|
188
|
+
- Independent integration powered by UnitBytes; not affiliated with or endorsed by Alibaba Group, 1688.com, or Goofish/Xianyu.
|
|
189
|
+
- Licensed under the [MIT License](./LICENSE).
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# goofish-xianyu-api — Goofish (Xianyu / 闲鱼) Search, Seller Inventory & Reviews Python SDK
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/goofish-xianyu-api/)
|
|
6
|
+
[](https://www.python.org/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
> **Disclaimer:** Independent integration powered by UnitBytes; not affiliated with or endorsed by Alibaba Group, 1688.com, or Goofish/Xianyu.
|
|
10
|
+
|
|
11
|
+
**`goofish-xianyu-api`** is a typed Python SDK and CLI (`goofish-xianyu` / `goofish-scrape`) for **Goofish / Xianyu (`闲鱼`)** secondhand & luxury resale intelligence — including keyword search, `m.tb.cn` mobile share-link resolution, listing details, seller storefront inventory (`onsale` & `sold`), buyer reviews, CNY-to-USD markdown math, and **Zhima Credit (`芝麻信用`)** seller trust scoring — with **zero Taobao/Alipay cookies required**.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Why Use `goofish-xianyu-api`?
|
|
16
|
+
|
|
17
|
+
- **Zero Login / Zero Cookie Churn / Zero Mandatory Dependencies** — Pure Python stdlib HTTP client (`0` required third-party packages); no +86 SMS verification, Alipay QR login, or local proxy rotation to maintain.
|
|
18
|
+
- **Multi-Provider Cloud Routing (`apify` • `unitbytes` • `rapidapi`)** — Auto-detects `APIFY_TOKEN` (warm Apify Standby HTTP + batch fallback), `UNITBYTES_API_KEY` (`https://api.unitbytes.com/v1/goofish/*`), or `RAPIDAPI_KEY` (`https://goofish-xianyu-marketplace-and-seller-api.p.rapidapi.com/v1/goofish/*`) with zero code changes.
|
|
19
|
+
- **Multi-Keyword Watchlist Sniper (`search_many` + `only_new`)** — Deduplicate across multiple keywords by canonical `itemId` and persist seen listings in an atomic local JSON state file so cron jobs alert only on newly listed deals.
|
|
20
|
+
- **Offline English → Xianyu Slang Glossary (`0` LLM Calls)** — Translate English product terms, ACG *guzi* merch (`badge` → `吧唧`, `plush` → `棉花娃娃`, `acrylic stand` → `立牌`), and Xianyu condition shorthand (`box and papers` → `箱说全`, `unopened` → `全新未拆封`) offline while preserving model numbers (`"Sony A7M4 mirrorless camera"` → `"索尼 A7M4 微单相机"`).
|
|
21
|
+
- **Cross-Border Proxy-Agent Links Built In** — Generate ready-to-open **Superbuy, AllChinaBuy, Sugargoo, CSSBuy, and Basetao** order URLs (`build_proxy_agent_links`) alongside CNY-to-USD markdown math (`analyze_resale_pricing`) and 0–100 **Zhima Credit (`芝麻信用`)** seller trust scoring (`assess_seller_trust`).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quickstart
|
|
26
|
+
|
|
27
|
+
### 1. Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install goofish-xianyu-api
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. Configure Your Free Starter API Token
|
|
34
|
+
|
|
35
|
+
Create a free Apify account (**\$5/month recurring platform credit included — no credit card required**) and copy your `APIFY_TOKEN`:
|
|
36
|
+
|
|
37
|
+
- **[Get a Free Apify API Token (\$5/mo credit included)](https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk)**
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export APIFY_TOKEN="apify_api_YOUR_TOKEN"
|
|
41
|
+
# Or use UnitBytes Direct Cloud API / RapidAPI with zero code changes:
|
|
42
|
+
# export UNITBYTES_API_KEY="ub_live_YOUR_KEY"
|
|
43
|
+
# export RAPIDAPI_KEY="YOUR_RAPIDAPI_KEY"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Zero-Login Live Keyword Search, Watchlist Deal Sniper & Seller Zhima Audit
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from goofish_xianyu_api import (
|
|
50
|
+
GoofishClient,
|
|
51
|
+
analyze_resale_pricing,
|
|
52
|
+
assess_seller_trust,
|
|
53
|
+
build_proxy_agent_links,
|
|
54
|
+
translate_keyword,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
client = GoofishClient() # Reads APIFY_TOKEN automatically
|
|
58
|
+
|
|
59
|
+
# 1) Offline English -> Simplified Chinese Xianyu slang translation (0 network calls)
|
|
60
|
+
print(translate_keyword("Sony A7M4 mirrorless camera box and papers"))
|
|
61
|
+
# -> "索尼 A7M4 微单相机 箱说全"
|
|
62
|
+
print(translate_keyword("Genshin Impact badge unopened"))
|
|
63
|
+
# -> "原神 吧唧 全新未拆封"
|
|
64
|
+
|
|
65
|
+
# 2) Multi-keyword watchlist sniper with cross-keyword itemId dedup & persistent state
|
|
66
|
+
new_deals = client.search_many(
|
|
67
|
+
["Sony A7C2 mirrorless", "Fujifilm X100VI box and papers", "Nintendo Switch OLED"],
|
|
68
|
+
max_items=45, # Auto-paginates warm Standby pages (>30 items)
|
|
69
|
+
translate_keywords=True, # Translates English terms into Chinese Xianyu slang
|
|
70
|
+
personal_only=True, # Filter out commercial storefronts (个人闲置)
|
|
71
|
+
free_shipping=True,
|
|
72
|
+
price_min=1000,
|
|
73
|
+
price_max=13500,
|
|
74
|
+
sort_by="newest",
|
|
75
|
+
only_new=True, # Emit only unseen itemIds across cron runs
|
|
76
|
+
state_file="watchlist_state.json",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
for item in new_deals[:5]:
|
|
80
|
+
pricing = analyze_resale_pricing(item, cny_to_usd=0.138)
|
|
81
|
+
agents = build_proxy_agent_links(item)
|
|
82
|
+
print(
|
|
83
|
+
f"[{item.get('matchedKeyword')}] {item['title']} -> "
|
|
84
|
+
f"¥{pricing.price_cny} (${pricing.price_usd}, -{pricing.discount_pct}%)"
|
|
85
|
+
)
|
|
86
|
+
print(f" Superbuy: {agents.superbuy}")
|
|
87
|
+
print(f" AllChinaBuy: {agents.allchinabuy}")
|
|
88
|
+
|
|
89
|
+
# 3) Resolve a raw Xianyu mobile share snippet or numeric item ID
|
|
90
|
+
detail = client.get_item_detail("【闲鱼】https://m.tb.cn/h.5xyz123 点击链接直接打开")
|
|
91
|
+
|
|
92
|
+
# 4) Audit seller Zhima Credit, KYC verification badges & negative buyer feedback
|
|
93
|
+
profile = client.get_seller_profile("2214891234567")
|
|
94
|
+
trust = assess_seller_trust(profile)
|
|
95
|
+
print(f"Trust Score: {trust.trust_score}/100 | Zhima: {trust.zhima_tier} | Risk: {trust.risk_level}")
|
|
96
|
+
|
|
97
|
+
sold_comps = client.get_seller_items("2214891234567", status="sold", max_items=20)
|
|
98
|
+
neg_reviews = client.get_seller_reviews("2214891234567", review_filter="negative_only", max_reviews=20)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Command-Line Interface (`goofish-xianyu` / `goofish-scrape`)
|
|
104
|
+
|
|
105
|
+
Export Goofish resale listings (enriched automatically with `resaleSummary` and `proxyAgentLinks`), seller profiles, and reviews to `json`, `jsonl`, or `csv`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Multi-keyword English -> Chinese watchlist sniper (persists unseen IDs in seen_deals.json)
|
|
109
|
+
goofish-xianyu --format jsonl search \
|
|
110
|
+
--keywords "Sony A7C2 mirrorless" "Pokemon card unopened" \
|
|
111
|
+
--translate \
|
|
112
|
+
--personal-only \
|
|
113
|
+
--max-items 40 \
|
|
114
|
+
--only-new seen_deals.json
|
|
115
|
+
|
|
116
|
+
# Search personal sellers and export USD markdowns + Superbuy/AllChinaBuy columns to CSV
|
|
117
|
+
goofish-xianyu --format csv --output deals.csv search "爱马仕 picotin" --personal-only --max-items 20
|
|
118
|
+
|
|
119
|
+
# Inspect a single listing (supports raw m.tb.cn share links)
|
|
120
|
+
goofish-xianyu --format json item "https://www.goofish.com/item?id=837465918273"
|
|
121
|
+
|
|
122
|
+
# Audit a seller's Zhima Credit + trust score
|
|
123
|
+
goofish-xianyu --format json seller 2214891234567 --include-items --include-reviews
|
|
124
|
+
|
|
125
|
+
# Export a seller's historical sold comps as JSONL
|
|
126
|
+
goofish-scrape --format jsonl seller-items 2214891234567 --status sold --max-items 20
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Direct Apify Actor JSON Input Compatibility
|
|
132
|
+
|
|
133
|
+
When triggering [`unitbytes/goofish-xianyu-search-scraper`](https://apify.com/unitbytes/goofish-xianyu-search-scraper?fpr=939u3w&fp_sid=pypi_sdk) directly via REST, n8n, or `prefer_standby=False`, pass multi-keyword queries as a comma-separated string in `keyword` (`"keyword": "索尼 A7C2, 富士 X100VI, Switch OLED"`). `GoofishClient.search_many(..., prefer_standby=False)` formats this automatically.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Upstream Actors & Pricing
|
|
138
|
+
|
|
139
|
+
| Capability | Apify Actor Slug | Landing Page | Pay-Per-Event Pricing |
|
|
140
|
+
| :--- | :--- | :--- | :--- |
|
|
141
|
+
| Keyword Search & Listing Detail | [`unitbytes/goofish-xianyu-search-scraper`](https://apify.com/unitbytes/goofish-xianyu-search-scraper?fpr=939u3w&fp_sid=pypi_sdk) | [unitbytes.com/actors/goofish-xianyu-search-scraper](https://unitbytes.com/actors/goofish-xianyu-search-scraper/) | \$0.002 search / \$0.003 detail |
|
|
142
|
+
| Seller Profile, Inventory (`onsale`/`sold`) & Reviews | [`unitbytes/goofish-scraper`](https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk) | [unitbytes.com/actors/goofish-xianyu-seller-scraper](https://unitbytes.com/actors/goofish-xianyu-seller-scraper/) | \$0.004 profile / \$0.0035 item / \$0.001 review |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Realistic Scope & Upstream Boundaries
|
|
147
|
+
|
|
148
|
+
- **Works Reliably Without Login:** Public Goofish keyword search, CNY price & personal-seller filters, `m.tb.cn` share-link resolution, full item descriptions & HD galleries, seller Zhima Credit tier (`极好`/`优秀`/`良好`), KYC verification badges (`实人认证`/`实名认证`), active & sold storefront inventory, and buyer feedback ratings.
|
|
149
|
+
- **Upstream Platform Boundaries:** Private buyer-seller chat messages, direct Alipay phone/account identifiers, and order checkout actions require an authenticated personal Goofish mobile app session and are outside the scope of public guest data extraction.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Legal & Compliance
|
|
154
|
+
|
|
155
|
+
- Extracts **publicly available marketplace listing & seller reputation metadata** only.
|
|
156
|
+
- Independent integration powered by UnitBytes; not affiliated with or endorsed by Alibaba Group, 1688.com, or Goofish/Xianyu.
|
|
157
|
+
- Licensed under the [MIT License](./LICENSE).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "goofish-xianyu-api"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Cookie-free Python SDK & CLI for Goofish (Xianyu / 闲鱼): secondhand & luxury deal search, listing details, seller inventory, buyer reviews, CNY resale discount math, and Zhima Credit trust scoring."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "UnitBytes", email = "contact@unitbytes.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"goofish",
|
|
17
|
+
"xianyu",
|
|
18
|
+
"idlefish",
|
|
19
|
+
"secondhand",
|
|
20
|
+
"recommerce",
|
|
21
|
+
"resale",
|
|
22
|
+
"luxury-authentication",
|
|
23
|
+
"zhima-credit",
|
|
24
|
+
"scraper",
|
|
25
|
+
"apify"
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 5 - Production/Stable",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"License :: OSI Approved :: MIT License",
|
|
31
|
+
"Operating System :: OS Independent",
|
|
32
|
+
"Programming Language :: Python :: 3",
|
|
33
|
+
"Programming Language :: Python :: 3.10",
|
|
34
|
+
"Programming Language :: Python :: 3.11",
|
|
35
|
+
"Programming Language :: Python :: 3.12",
|
|
36
|
+
"Programming Language :: Python :: 3.13",
|
|
37
|
+
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
|
|
38
|
+
"Topic :: Office/Business :: Financial",
|
|
39
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
40
|
+
"Typing :: Typed"
|
|
41
|
+
]
|
|
42
|
+
dependencies = []
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
apify = [
|
|
46
|
+
"apify-client>=1.7.0"
|
|
47
|
+
]
|
|
48
|
+
dev = [
|
|
49
|
+
"pytest>=8.0.0"
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.scripts]
|
|
53
|
+
goofish-xianyu = "goofish_xianyu_api.cli:main"
|
|
54
|
+
goofish-scrape = "goofish_xianyu_api.cli:main"
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://unitbytes.com/actors/goofish-xianyu-seller-scraper/"
|
|
58
|
+
Documentation = "https://unitbytes.com/actors/goofish-xianyu-seller-scraper/"
|
|
59
|
+
"Apify Store" = "https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk"
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.packages.find]
|
|
62
|
+
where = ["src"]
|
|
63
|
+
|
|
64
|
+
[tool.setuptools.package-data]
|
|
65
|
+
goofish_xianyu_api = ["py.typed"]
|
|
66
|
+
|
|
67
|
+
[tool.pytest.ini_options]
|
|
68
|
+
pythonpath = ["src"]
|
|
69
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Cookie-free Python SDK & CLI for Goofish / Xianyu (闲鱼): search, items, seller inventory, reviews, and Zhima trust."""
|
|
2
|
+
|
|
3
|
+
from .client import (
|
|
4
|
+
DEFAULT_RAPIDAPI_HOST,
|
|
5
|
+
DEFAULT_UNITBYTES_API_URL,
|
|
6
|
+
SIGNUP_URL,
|
|
7
|
+
ActorSlugs,
|
|
8
|
+
GoofishApiError,
|
|
9
|
+
GoofishAuthError,
|
|
10
|
+
GoofishClient,
|
|
11
|
+
GoofishError,
|
|
12
|
+
GoofishRunError,
|
|
13
|
+
StandbyEndpoints,
|
|
14
|
+
)
|
|
15
|
+
from .helpers import (
|
|
16
|
+
GOOFISH_KEYWORD_DICTIONARY,
|
|
17
|
+
ProxyAgentLinks,
|
|
18
|
+
ResalePriceSummary,
|
|
19
|
+
SellerTrustAssessment,
|
|
20
|
+
analyze_resale_pricing,
|
|
21
|
+
assess_seller_trust,
|
|
22
|
+
build_proxy_agent_links,
|
|
23
|
+
build_superbuy_url,
|
|
24
|
+
convert_cny_price,
|
|
25
|
+
extract_item_id,
|
|
26
|
+
filter_unseen_items,
|
|
27
|
+
format_records,
|
|
28
|
+
load_watchlist_state,
|
|
29
|
+
normalize_condition_label,
|
|
30
|
+
normalize_item_target,
|
|
31
|
+
normalize_seller_target,
|
|
32
|
+
save_watchlist_state,
|
|
33
|
+
translate_keyword,
|
|
34
|
+
translate_keywords,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
__version__ = "1.0.0"
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"__version__",
|
|
41
|
+
"SIGNUP_URL",
|
|
42
|
+
"DEFAULT_UNITBYTES_API_URL",
|
|
43
|
+
"DEFAULT_RAPIDAPI_HOST",
|
|
44
|
+
"ActorSlugs",
|
|
45
|
+
"StandbyEndpoints",
|
|
46
|
+
"GoofishClient",
|
|
47
|
+
"GoofishError",
|
|
48
|
+
"GoofishAuthError",
|
|
49
|
+
"GoofishApiError",
|
|
50
|
+
"GoofishRunError",
|
|
51
|
+
"GOOFISH_KEYWORD_DICTIONARY",
|
|
52
|
+
"ProxyAgentLinks",
|
|
53
|
+
"ResalePriceSummary",
|
|
54
|
+
"SellerTrustAssessment",
|
|
55
|
+
"normalize_item_target",
|
|
56
|
+
"normalize_seller_target",
|
|
57
|
+
"extract_item_id",
|
|
58
|
+
"translate_keyword",
|
|
59
|
+
"translate_keywords",
|
|
60
|
+
"build_proxy_agent_links",
|
|
61
|
+
"build_superbuy_url",
|
|
62
|
+
"load_watchlist_state",
|
|
63
|
+
"save_watchlist_state",
|
|
64
|
+
"filter_unseen_items",
|
|
65
|
+
"convert_cny_price",
|
|
66
|
+
"normalize_condition_label",
|
|
67
|
+
"analyze_resale_pricing",
|
|
68
|
+
"assess_seller_trust",
|
|
69
|
+
"format_records",
|
|
70
|
+
]
|