Skip to content

feat: add Lenovo CLI (search, recommend, detail, cart, AI chat)#771

Closed
shuitian23-bot wants to merge 3 commits intojackwener:mainfrom
shuitian23-bot:feat/lenovo-cli
Closed

feat: add Lenovo CLI (search, recommend, detail, cart, AI chat)#771
shuitian23-bot wants to merge 3 commits intojackwener:mainfrom
shuitian23-bot:feat/lenovo-cli

Conversation

@shuitian23-bot
Copy link
Copy Markdown

Summary

Add 5 built-in commands for lenovo.com.cn (联想商城):

Command Description
opencli lenovo search --keyword "ThinkPad" 搜索商品
opencli lenovo hot --category laptop 热销/推荐商品
opencli lenovo detail --id 1042860 商品详情(配置、价格、库存)
opencli lenovo cart --id 1042860 加入购物车(需登录)
opencli lenovo ask --question "小新和ThinkPad哪个好" 联想乐享AI问答

All commands use Strategy.UI (browser automation) since lenovo.com.cn is server-rendered without public REST APIs.

Implementation

  • search / hot: Navigate to s.lenovo.com.cn/search/, extract product data from .productDetail li[latag] elements
  • detail: Navigate to item.lenovo.com.cn/product/{id}.html, extract specs from .spec-big and price from .estimatedAvailabilityBuyNum
  • cart: Click #jrgwc (加入购物车) button on product page, requires browser login session
  • ask: Interact with leai.lenovo.com.cn — input question via .van-field__control, send with Enter key, wait for .response-text to stabilize

Test plan

  • opencli lenovo search --keyword "YOGA" --limit 5 — returns product table
  • opencli lenovo hot --category laptop --limit 3 — returns recommended laptops
  • opencli lenovo detail --id 1042860 — returns product name, price, specs, stock
  • opencli lenovo ask --question "联想小新Pro14和ThinkPad E14哪个好" — returns AI comparison

🤖 Generated with Claude Code

白羽 added 3 commits April 4, 2026 18:36
Add 5 commands for lenovo.com.cn (联想商城):
- search: search products by keyword
- hot: browse trending/recommended products by category
- detail: view product specs, price and stock
- cart: add product to cart (requires login)
- ask: chat with Lenovo LeAI assistant (联想乐享AI问答)

All commands use browser automation (Strategy.UI) since
lenovo.com.cn is server-rendered without public REST APIs.
@jackwener jackwener closed this Apr 4, 2026
@jackwener
Copy link
Copy Markdown
Owner

这不是一个很通用的网站,你可以直接在本地使用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants