Use the repository's existing sau xueqiu; do not write a separate web upload implementation. First check sau xueqiu upload-article --help. On Windows, when not added to PATH, use .\.venv\Scripts\sau.exe。
Account and Input
- For an existing account, run
sau xueqiu check --account <别名>. On first use, runsau xueqiu login --account <别名> --expected-name "用户指定昵称"and log in in the opened Chrome. The program saves the session and binds it to the real user ID; do not write account credentials into commands or source code. Logging in through Codex's built-in browser will not automatically generate a CLI session file. - You must provide a non-empty single-line
--title、UTF-8 HTML/Markdown/TXT--content-fileand a--declarationthat matches the actual authoring method. The declaration chooses不添加创作声明or本文包含AI生成内容; do not guess on the user's behalf. --visibilityis公开or私人, public by default. Body images are written at the corresponding positions in the original manuscript via HTMLimgor Markdown images, with relative paths based on the manuscript directory; without--images, the parameter is appended at the end of the text. Use--coverfor a separate cover image, using the platform's default cropping. Images accept local GIF/JPEG/PNG; remote or data URLs are not accepted.- Headings at all levels on Xueqiu are uniformly converted to the platform's subheadings, preserving paragraphs, bold, italics, and links; lists are converted to paragraphs with numbers or bullets. Custom CSS is not guaranteed to be preserved. Unverified structures such as tables and code blocks raise an error before the remote draft is created. For first-time Markdown use, run
sau article setup; see the usage instructions for details.
Draft and Publishing
sau xueqiu upload-article --account <别名> --title "用户标题" --content-file "文章.md" --cover "封面.png" --visibility 私人 --declaration "本文包含AI生成内容"
The command actually publishes by default. To only check the draft and preview, explicitly add --prepare-only; Xueqiu automatically saves a remote draft, and repeated runs may create multiple drafts. The editor refuses to overwrite if it already has content. Omit --cover。
when no separate cover image is needed. Prefer the Markdown manuscript; use Markdown image syntax with paths relative to the manuscript for inline images between paragraphs, for example . On first use, run sau article setup。
The official CLI has been actually tested with native structure, two different inline images between paragraphs, a separate cover image, private publishing, and querying the original work in the backend. Follow the user's scope of operation; development or login authorization alone does not authorize publishing test content.
There is no scheduling parameter: no scheduling feature was observed in this account's full long-form form. Word, custom cropping, video, and stock/topic/@-linked objects are not yet supported; do not pass off plain text as a linked object.
Result Checking and Interruption Handling
Keep the result JSON path and screenshots from the command output.prepared only means preparation is complete;published means the platform finally accepted it and the subject, title, sharing scope, and body were verified.management_verified: true means the backend query by original ID also passed. Private works show "visible only to yourself."
If the record is submission_unknown, run sau xueqiu verify --account <别名> --result "本次结果文件.json"to perform a read-only query using the saved original work ID, and recheck the backend body and images against the original manuscript. Keep the manuscript, images, and paths used at publication time; changed content will raise an error. Successful results from older versions that lack the manuscript path only verify the work's identity and sharing scope. When there is no ID, go to "Content Management" and check by title, account, and time. Before the cause is determined, do not rerun the upload or click publish again, to avoid duplicate works.
By default, use visible Chrome,--headless is the explicit option; local headless access was previously blocked by the platform. Network timeouts, 403, or subject inconsistency should preserve the specific error, and Cookie invalidation should not be asserted based on them.--debug Save a failure screenshot.
Example scripts
scripts/examples/ The files under are examples for copying, not runtime dependencies. Before executing, first check the current CLI's --help, and replace the account, materials, and body text; these commands may create real works.
xueqiu_commands.ps1:PowerShellxueqiu_commands.sh:Bashxueqiu_cli_template.py:Python subprocess