Files
EFAuto/README.md
T
cat-shark 401c879ffd Initial commit: EF course autopilot tool
Auto-complete EF English courses with JWT token authentication.
Supports multiple task types: multiple-choice, gapfill, matching,
flashcards, speaking-practice, text-highlights, sequencing,
media-with-time-markers, language-focus.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 22:11:48 +08:00

76 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# EF Course Autopilot
自动完成 EF (English First) 企业英语课程的工具。
## 文件说明
| 文件 | 说明 |
|---|---|
| `ef_course_autopilot.py` | 核心脚本 — 自动完成单门课程 |
| `ef_course_loop.py` | 交互式循环脚本 — 批量完成多门课程(**推荐使用**)|
| `token.txt` | JWT token 文件(需自行创建) |
## 快速开始
### 1. 获取 JWT Token
1. 用 Chrome 打开 `https://learn.corporate.ef.com.cn` 并登录
2. 按 F12 打开开发者工具 → 切换到 **Network(网络)** 标签
3. 找一个请求,复制其请求头中 `ef_access_token` 的值(一长串 JWT 字符串)
4. 将复制的 token 粘贴到 `token.txt` 文件,**仅保留一行内容,不要有多余换行或空格**
### 2. 运行
```bash
python3 ef_course_loop.py
```
脚本会自动读取运行目录下的 `token.txt`,然后交互式询问课程数量,完成后询问是否继续。
如需指定自定义 token 文件路径:
```bash
python3 ef_course_loop.py --token-file /path/to/token.txt
```
SSL 验证默认禁用(macOS Python 证书问题),如需启用:
```bash
python3 ef_course_loop.py --verify-ssl
```
## 工作原理
脚本模拟浏览器请求,按以下步骤自动完成课程:
1. **GET focus** — 获取当前课程的 courseId / nodeId
2. **POST open-lesson** — 打开课程,获取 lessonId
3. **POST lesson/command (open-lesson)** — 初始化课程,获取全部 Activity/Task
4. **POST lesson/command (submit-task-response) ×N** — 逐个提交任务答案
### 支持的任务类型
- `multiple-choice` — 选择题(随机选一个选项)
- `language-focus` — 语言知识点(标记已查看)
- `media-with-time-markers` — 音视频(标记已播放)
- `gapfill` — 填空(保留 expectedResponse
- `matching` — 匹配题(保留 expectedResponse
- `flashcards` — 闪卡(所有卡片标记已翻转)
- `text-highlights` — 文本高亮(标记已查看)
- `sequencing` — 排序(保留 expectedResponse
- `speaking-practice` — 口语练习(可跳过)
## SSL 证书问题
macOS 上 Python 3.12 可能出现 `SSL: CERTIFICATE_VERIFY_FAILED` 错误。
**解决办法一:安装证书**
```bash
/Applications/Python\ 3.12/Install\ Certificates.command
```
**解决办法二:启用验证**(如需)
```bash
python3 ef_course_loop.py --verify-ssl
```