Core Principles
- The user must first provide a roundup thread: usually
https://articles.zsxq.com/id_xxx.html, but it can also be a Knowledge Planet topic link. - You must first read the roundup thread and display the image-and-text topic list, and only count likes after the user confirms.
- When confirming, you must explain the counting rules; if the list does not match the user's expectations, remind the user to modify the roundup thread content format themselves, then re-read the preview.
- Do not guess link attribution based on dates, subheadings, adjacent lines, or context. When the format is non-standard, do not manually add links.
- Before confirmation, only do a list preview; after confirmation, fetch the current like counts according to the confirmed preview JSON and export a CSV.
Counting Rules
The default rules must be told to the user verbatim:
- Parse the roundup thread content paragraph by paragraph/line by line.
- Only include links that, within the same paragraph/same line, contain both
图文and a Knowledge Planet link. t.zsxq.comShort links resolve via redirect totopic_id;wx.zsxq.comtopic links resolve directly totopic_id。- When there are multiple Knowledge Planet topic links in the same line, include all of them.
- Non-Knowledge Planet links such as WeChat Channels, Official Accounts, and external web pages are not included.
- If
图文and the link are split across different lines, they are not included by default; ask the user to first modify the roundup thread format themselves, then preview again. - The like count comes from the
counts.likescurrently returned by the topic detail API, and the result will change as the user likes posts later.
Quick Process
- Confirm that the user has provided a roundup thread URL; if not, first ask the user to provide one.
- Run the preview command:
SKILL_DIR="$HOME/.codex/skills/zsxq-tuwen-likes-export" python3 "$SKILL_DIR/scripts/tuwen_likes_export.py" preview \ --source-url '<汇总贴URL>' \ --out-dir outputs \ --prefix summary - Open the
*_preview.mdoutput by the script or read the terminal summary, and send the image-and-text topic list and the above counting rules to the user for confirmation. - If the user points out omissions or attribution errors, do not continue counting; remind the user to first modify the roundup thread so that each image-and-text item and its corresponding link are in the same paragraph/same line, then run the preview again.
- After the user explicitly confirms it is correct, run the export command:
SKILL_DIR="$HOME/.codex/skills/zsxq-tuwen-likes-export" python3 "$SKILL_DIR/scripts/tuwen_likes_export.py" export \ --preview-json outputs/summary_tuwen_preview.json \ --out-dir outputs \ --prefix summary - Validate the CSV:
python3 - <<'PY' import csv detail=list(csv.DictReader(open('outputs/summary_tuwen_like_details.csv', encoding='utf-8-sig'))) summary=list(csv.DictReader(open('outputs/summary_tuwen_likes_by_author.csv', encoding='utf-8-sig'))) print(len(detail), len(summary)) print(sum(int(r['likes_count']) for r in detail), sum(int(r['total_likes']) for r in summary)) print(all(r['fetch_success'] == 'True' for r in detail)) PY
Output Files
Preview stage:
<prefix>_tuwen_preview.json: candidate topic list for confirmation; the export stage must use this file.<prefix>_tuwen_preview.md: Markdown list for the user to confirm.
Export stage:
<prefix>_tuwen_like_details.csv: image-and-text details, including topic, author, likes, comments, reads, link, and source line.<prefix>_tuwen_likes_by_author.csv: summary by author, including topic count, total likes, average likes, highest likes, total comments, and total reads.<prefix>_tuwen_export.json: export diagnostic data, useful for troubleshooting field or API issues.
Common Issues
- The preview list is missing an item: usually
图文and the Knowledge Planet link are not in the same paragraph/same line. Have the user modify the roundup thread format and rerun the preview. - The preview list has an extra item: usually a line contains both
图文and multiple Knowledge Planet links. Have the user adjust the roundup thread and move links that should not be counted out of that line. - A short link cannot be resolved: rerun the preview; if it still fails, ask the user to replace the short link with a
wx.zsxq.comtopic link and try again. - The like count is inconsistent with what is seen on the page: use the current value returned by the topic detail API at export time as the source of truth, and check whether a new like was just added or there is cache delay.