SuperAPI AI Directory

zsxq-homework-likes-export

Data & analytics

View repository

Updated 10-16 08:22

About this skill

Knowledge Planet assignment like export

Core principles

  • Prefer using the real web interface https://api.zsxq.com/v2/topics/{task_id}/solutions, because each returned solution carries the parent assignment task_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 --json to export to /tmp temporary file.
  • Temporary cookies,XAduid are 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

  1. Prepare the task configuration JSON.
    • You can copy references/tasks.example.json, and fill in your own group_id, assignment question topic_id and 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_topics to get the task list, then write it in the same structure.
  2. Open the web login session:
    agent-browser --headed --session zsxq-homework open 'https://wx.zsxq.com/'
    
    Have the user log in and confirm they can see the target planet content.
  3. 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
    
  4. 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
    
  5. 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
    
  6. 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-side X-Signature and other request headers. You must use this skill's signed scraping script, do not directly fetch。
  • 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.json generated precise CSV, not the output of the old keyword-matching script.