Core principles
- Prefer using the real web interface
https://api.zsxq.com/v2/topics/{task_id}/solutions, because each returnedsolutioncarries the parent assignmenttask_uid。 - Do not infer assignment ownership using keywords or time windows, unless the user explicitly accepts rough statistics.
- Do not ask the user to paste cookies. Open a local visible browser and have the user log in in the browser; then use
agent-browser cookies --jsonto export to/tmptemporary file. - Temporary cookies,
XAduidare only used for local scraping and should be deleted immediately after completion. Do not print credentials in the terminal or in the final answer.
Quick workflow
- Prepare the task configuration JSON.
- You can copy
references/tasks.example.json, and fill in your owngroup_id, assignment questiontopic_idand title. - If the user wants to switch planets, switch tags, or refresh the task list, first use
zsxq-cli group +list、zsxq-cli group +hashtags、zsxq-cli api call get_hashtag_topicsto get thetasklist, then write it in the same structure.
- You can copy
- Open the web login session:
Have the user log in and confirm they can see the target planet content.agent-browser --headed --session zsxq-homework open 'https://wx.zsxq.com/' - Export the temporary login session:
agent-browser --session zsxq-homework cookies --json > /tmp/zsxq_homework_cookies.json agent-browser --session zsxq-homework eval "localStorage.getItem('XAduid') || ''" > /tmp/zsxq_homework_xaduid.txt - Scrape the real submission list for each assignment question:
SKILL_DIR="$HOME/.codex/skills/zsxq-homework-likes-export" node "$SKILL_DIR/scripts/fetch_zsxq_task_solutions_signed.mjs" \ "$SKILL_DIR/references/tasks.example.json" \ /tmp/zsxq_homework_cookies.json \ /tmp/zsxq_homework_xaduid.txt \ outputs/course_homework_task_solutions_raw_signed.json - Generate CSV:
SKILL_DIR="$HOME/.codex/skills/zsxq-homework-likes-export" python3 "$SKILL_DIR/scripts/build_homework_likes_csv.py" \ outputs/course_homework_task_solutions_raw_signed.json \ outputs - Validate and clean up:
python3 - <<'PY' import csv detail=list(csv.DictReader(open('outputs/course_homework_submission_likes_detail.csv', encoding='utf-8-sig'))) summary=list(csv.DictReader(open('outputs/course_homework_likes_by_student.csv', encoding='utf-8-sig'))) print(len(detail), len(summary)) print(sum(int(r['likes']) for r in detail), sum(int(r['total_likes']) for r in summary)) PY rm -f /tmp/zsxq_homework_cookies.json /tmp/zsxq_homework_xaduid.txt
Output files
Generated by default:
<prefix>_likes_by_student.csv: student summary table, including total likes, submission count, and likes under each assignment question.<prefix>_submission_likes_detail.csv: submission detail table, including assignment question, student, submission topic, likes, comments, views, link, and summary.
Task configuration format
{
"group_id": "123456789012",
"output_prefix": "course_homework",
"tasks": [
{"id": "11111111111111111", "title": "示例作业 01:第一次作业"}
]
}
Common issues
code=1059: usually missing web-sideX-Signatureand other request headers. You must use this skill's signed scraping script, do not directlyfetch。401 Unauthorized: the web login session has expired; have the user log in again in the visible browser.- Insufficient CSV accuracy: confirm that you are using the
*_raw_signed.jsongenerated precise CSV, not the output of the old keyword-matching script.