mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
df8ca8d440
* feat(xianyu): search 支持服务端价格区间 / 地区筛选(--min-price/--max-price/--province/--city)
闲鱼 search 之前只有 query + limit。本次改成直接调 goofish 自己的搜索接口
`mtop.taobao.idlemtopsearch.pc.search`(沿用 item.js 里 window.lib.mtop.request
的用法,签名由页面自带,无需手搓),把价格区间和地区交给服务端筛选 + 分页,
而不是抓一屏 DOM 再在本地过滤。
筛选编码是在登录态浏览器里 hook window.lib.mtop.request、实际操作筛选面板抓到
真实请求后逆出来的,并逐条用接口返回 + 详情接口 publishCity 做了 ground-truth 校验:
- --min-price / --max-price → propValueStr.searchFilter = "priceRange:<min>,<max>;"
(元;单边区间用 0 / 99999999 兜底)。实测 priceRange:100000,150000 返回价格
全部落在 112999–149900。
- --province / --city → extraFilterValue = JSON({divisionList:[{province,city}],
excludeMultiPlacesSellers:"0",extraDivision:""})。city 可单独使用(province 留空)。
实测「广东」「北京」结果集完全不相交;--city 深圳 / 湛江 的结果用详情接口校验
publishCity 全部命中。
- 任一筛选生效时 fromFilter=true。limit 最多 60,按需翻页(rowsPerPage=30)。
返回字段改为结构化解析(item_id / title / price / location / want / url),
鉴权与风控错误处理沿用 item.js 的成熟逻辑(AuthRequired / Empty / mtop-not-ready)。
已在登录态浏览器里真跑验证(深圳+10–20万、湛江、无筛选基线均正确),
clis/xianyu 45 个单测全绿,tsc --noEmit 通过,cli-manifest.json 同步重建。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(xianyu): harden search filter result handling
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: jackwener <jakevingoo@gmail.com>
3.4 KiB
3.4 KiB
Xianyu (闲鱼)
Mode: 🔐 Browser · Domain: goofish.com
Commands
| Command | Description |
|---|---|
opencli xianyu search <query> |
Search Xianyu items by keyword and return item cards with item_id; supports server-side price and region filters |
opencli xianyu item <item_id> |
Fetch item details including title, price, condition, brand, seller, and image URLs |
opencli xianyu inbox |
List recent Xianyu private-message conversations, including unread and unread_count |
opencli xianyu messages <item_id> <user_id> |
Read recent visible messages from a specific Xianyu conversation |
opencli xianyu chat <item_id> <user_id> |
Open a Xianyu chat session for the item/user pair and optionally send a message with --text |
opencli xianyu reply <item_id> <user_id> --text <message> |
Reply to a specific Xianyu private-message conversation |
opencli xianyu publish <title> <description> <price> <condition> <category> |
Publish a Xianyu listing from the authenticated browser session |
Usage Examples
# Search items
opencli xianyu search "macbook" --limit 5
opencli xianyu search "小鹏G9" --min-price 100000 --max-price 200000 --city 深圳 --limit 10
# Read a single item's details
opencli xianyu item 1040754408976
# List recent private-message conversations
opencli xianyu inbox --limit 20 -f json
opencli xianyu inbox --unread-only true -f json
# Read messages from a specific conversation
opencli xianyu messages 1038951278192 3650092411 --limit 50 -f json
opencli xianyu messages --rank 1 --limit 50 -f json
# Open a chat session
opencli xianyu chat 1038951278192 3650092411
# Send a message in chat
opencli xianyu chat 1038951278192 3650092411 --text "你好,这个还在吗?"
# Reply to a specific conversation
opencli xianyu reply 1038951278192 3650092411 --text "你好,这个还在吗?"
opencli xianyu reply --rank 1 --text "你好,这个还在吗?"
# Publish a listing immediately
opencli xianyu publish "MacBook Pro" "成色很好,功能正常" 5999 "轻微使用" "笔记本" --images /tmp/a.jpg,/tmp/b.jpg
# JSON output
opencli xianyu search "笔记本电脑" -f json
opencli xianyu item 1040754408976 -f json
Prerequisites
- Chrome running and logged into
goofish.com - Browser Bridge extension installed
Notes
searchreturnsitem_id, which can be passed directly intoopencli xianyu itemsearch --min-price/--max-price/--province/--citysends filters through Xianyu's search API instead of filtering returned rows client-sideinboxreturnsunreadandunread_count; use--unread-only trueto list only unread conversationsinbox --resolve-ids trueattempts to click visible rows and resolveitem_id/peer_user_id, but Xianyu may keep some conversations in SPA state without exposing IDs in the URLmessages --rank <n>andreply --rank <n>operate on the visible row number returned byinbox, which is more reliable for Xianyu's current IM UIchatandreplyrequire both the item ID and the target user'suser_id/peerUserIdmessagesreads currently visible/recent messages in the conversation view; older messages may require the site to load more historypublishexecutes immediately after filling the listing form; supported conditions are全新,几乎全新,轻微使用,明显使用, and老旧- Browser-authenticated commands depend on the active Chrome login session remaining valid