chaoxing-downloader
学习通课程视频下载工具,支持浏览器登录、课程/章节/视频三级浏览
依赖:Python 3.11+、httpx、beautifulsoup4、DrissionPage,并需要本机已安装 Chrome 或 Edge 等 Chromium 系浏览器。
Python 库使用,见 Python API 文档。
安装
pip install chaoxing-downloader
登录
chaoxing-downloader init
会弹出浏览器,手动登录超星后自动:
- 采集
.chaoxing.comcookie 并写入config.toml - 写入课程列表和课程入口参数到
.chaoxing-cache.json
可选参数:
--config config.toml 配置文件写入路径(默认 config.toml)
--user-data-dir .chaoxing-browser 浏览器数据目录
--timeout 300 等待登录超时秒数
--course-delay 2.0 预热课程入口时,每门课程进入前等待秒数
--browser-port 9223 DrissionPage 本地调试端口
配置文件
默认读当前目录的 config.toml,由 init 自动生成,通常不需要手动编辑:
[session]
cookie = "UID=...; vc3=...; uf=...; p_auth_token=..."
referer = "https://mooc1.chaoxing.com/"
[entry]
base_url = "https://i.chaoxing.com/base"
[download]
output_dir = "downloads"
[cache]
path = ".chaoxing-cache.json"
[browser]
port = 9223
用法
# 列出所有课程
chaoxing-downloader list-courses
# 列出某门课的章节
chaoxing-downloader list-chapters --course course-54600bb5
# 列出某章节的视频
chaoxing-downloader list-videos --chapter chapter-0434a4f3
# 下载视频
chaoxing-downloader download-video --video video-6d0d9300
# 清理缓存
chaoxing-downloader clear-cache
课程/章节/视频查询和下载命令支持 --delay <seconds>,用于降低请求频率:
chaoxing-downloader list-courses --delay 1.5
chaoxing-downloader list-chapters --course course-54600bb5 --delay 1.5
chaoxing-downloader list-videos --chapter chapter-0434a4f3 --delay 1.5
chaoxing-downloader download-video --video video-6d0d9300 --delay 1.5
所有命令支持 --config <path> 指定配置文件。
Python 示例
仓库内提供了一个最小示例脚本,会自动判断是否已初始化、列出第一个课程/章节/视频并下载:
python examples/download_first_video.py
缓存
解析结果缓存在 .chaoxing-cache.json(路径由 [cache].path 控制),包括课程/章节/视频的 key、URL、object_id 和下载地址。
课程入口参数
部分课程进入章节时需要从课程入口页拿到 enc、t 等参数。init 会在登录后自动预热课程并缓存最终课程入口 URL,正常情况下不需要手动处理。
常见问题
浏览器未启动或 DrissionPage 未安装
.\.venv\Scripts\python -m pip install DrissionPage
DrissionPage 会复用本机 Chromium 系浏览器,不需要额外下载浏览器内核。
中文乱码
$env:PYTHONIOENCODING='utf-8'
未安装为命令
$env:PYTHONPATH='.\src'
python -m chaoxing_downloader list-courses
许可证
本项目基于 MIT License 开源。
免责声明
本项目仅用于用户本人已授权课程的视频离线学习和技术研究,不提供任何课程资源,不支持免登录、绕过权限、绕过付费、破解加密或 DRM。
使用者应遵守所在学校、平台服务协议和相关法律法规。通过本工具下载的内容仅限个人学习使用,不得传播、转售、公开分享或用于任何商业用途。因使用本项目产生的账号风险、版权纠纷或其他后果由使用者自行承担。
本项目不会上传、收集或共享用户 Cookie、课程信息和下载内容。
Metadata
Release files for chaoxing-downloader 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chaoxing_downloader-0.1.3.tar.gz | 31.5 kB | Without provenance | Details for chaoxing_downloader-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chaoxing_downloader-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for chaoxing_downloader-0.1.3-py3-none-any.whl |
Total release size: 59.1 kB
Release files / chaoxing_downloader-0.1.3.tar.gz
| Download URL | chaoxing_downloader-0.1.3.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d8c4e7b9e9b20b84ea51f75e4d0b9ad51c9f1013aaa0259981e3f14fc073dfc
|
|
BLAKE2b-256 checksum How to use checksums |
aeda35f476b3a6f14de37ca689b0c24ed7383d518aa3936b315f69dc055a76f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / chaoxing_downloader-0.1.3-py3-none-any.whl
| Download URL | chaoxing_downloader-0.1.3-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ead05bee1528574a667acdc0907073714418fda8b2df8d73604870c5914745ee
|
|
BLAKE2b-256 checksum How to use checksums |
76173fd022d5796deddeaf79836ad2d13b86ef8728d02b375022437d97001027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for chaoxing-downloader 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.