Used for messages and lightweight interactive operations. All commands go through:
python scripts/cli.py <command>
Applicable scenarios
- View the Xianyu message list.
- Open the chat with a specified item's seller/buyer.
- Send inquiry or reply messages.
- Favorite competitor or target items.
- Click 'I want it' to trigger the inquiry flow.
Common commands
python scripts/cli.py list-messages
python scripts/cli.py open-chat --item-id ITEM_ID --peer-user-id USER_ID
python scripts/cli.py send-message --content-file D:/abs/message.txt
python scripts/cli.py send-message --content "你好,请问这个还在吗?"
python scripts/cli.py favorite-item --item-id ITEM_ID
python scripts/cli.py want-item --item-id ITEM_ID
Recommended workflow
View and reply to inquiries
- Run
list-messagesto view the message summary. - Determine whether you need to enter a specific conversation.
- Use
open-chat --item-id ... --peer-user-id ...to open the conversation. - Draft the reply content and have the user confirm it.
- Execute
send-message。
Competitor interaction
- Via
search-itemsfind the target item. - When a favorite is needed, execute
favorite-item。 - When you need to enter the inquiry flow, execute
want-itemoropen-chat。 - Do not perform high-frequency interactions in batches; report the executed actions to the user each time.
Output interpretation
list-messagesReturns a text summary of the message page and the current URL; structured contact IDs are currently not guaranteed.open-chatReturns the chat page URL and title.send-messageReturnssuccess: trueandstatus: 消息已发送indicates the message has been sent out.favorite-item/want-itemReturns the action type, item ID, and current URL.
Confirmation policy
send-messageis a real outbound action; confirm the final text before executing.favorite-itemandwant-itemwill change the account status and can be executed when the user explicitly requests it.- Operations such as batch interactions, consecutive private messages, and repeated clicks on 'I want it' should maintain a reasonable interval.
- Do not send off-platform traffic diversion, contact information, transaction inducement, or non-compliant promises.
Known limitations
list-messagescurrently mainly returns text summaries and does not reliably provideitem_id/peer_user_id。- If chat parameters are missing, they can be obtained from the item detail page, search results, or page links, and then call
open-chat。 - The chat page may fail to locate the input box due to platform redesign; on failure, return the page prompt and do not claim it has been sent.
Failure handling
- Message not sent: check whether a specific conversation has been opened and whether the input box is visible.
- Failed to open chat: confirm whether
item-idandpeer-user-idare valid. - Favorite/'I want it' failed: confirm the item is not delisted and the page opens normally.
- If the platform shows a security verification: stop automated operations and let the user handle it in the browser.