High-performance CSDN resource downloader with automated limits, authentication, and a modern frontend interface.
- This project is an open-source self-hosted tool and is not an official CSDN product or service.
- This project is not designed to discover, exploit, bypass, or weaponize any CSDN vulnerability, paywall, access control, DRM, or security mechanism.
- This repository does not provide any hosted download service, public mirror, proxy node, shared account, or centralized download API. You must deploy and operate it in your own environment.
- The maintainers of this repository do not operate any public instance or public download service for this project.
- This repository does not bundle, ship, cache for redistribution, or permanently host CSDN resources. It only orchestrates requests initiated by the deployer or end user under their own configuration.
- The project itself does not maintain a resource library, does not provide resource hosting, and is not intended to store or redistribute downloaded content as a content platform. Any persistence, caching, archiving, or redistribution introduced by a third-party deployment is outside the scope of this repository and remains that operator's sole responsibility.
- You must use your own account credentials, cookies, OAuth credentials, and infrastructure, and you are solely responsible for ensuring that your use complies with CSDN's terms, copyright rules, local law, and any other applicable obligations.
- If you do not have the right to access, download, copy, or use a resource, do not use this project for that purpose.
- Automated Downloading: Efficiently fetches CSDN resources.
- Smart Quota Management:
- Global Monthly Limit: Configurable static monthly limit for the entire system.
- User Monthly Limit: Individual user quotas based on Trust Levels (Level 0-3).
- Authentication: Secure login via LinuxDO OAuth.
- Modern UI:
- Beautiful, minimalist frontend inspired by Claude.
- One-click Copy: Download links are displayed for easy copying.
- Real-time dashboard showing monthly remaining quotas.
- Interactive "Follow Me" footer with social links.
- Robust Backend: Built with Go, featuring standardized JSON API responses and JWT-based session management.
- Backend: Go (Golang)
- Database: MongoDB
- Frontend: Vanilla HTML/CSS/JS
- Auth: OAuth2 (LinuxDO), JWT
- Containerization: Docker
- Go 1.23+ (If running locally)
- A valid CSDN VIP Account Cookie JSON array
- LinuxDO OAuth Application credentials
- MongoDB Instance (or MongoDB Atlas URI)
-
Clone the repository:
git clone <your-repo-url> cd CSDNAutoDownloader
-
Configuration (.env):
Copy the example configuration file and fill in your details:
cp .env.example .env
Open
.envand configure the following variables (see Configuration for details). -
Use the prebuilt Docker Hub image (Recommended for deployment):
You can use the prebuilt image published to Docker Hub instead of building locally:
docker pull d1caprio/csdn-downloader:latest docker run -d -p 8181:8181 -v "$(pwd)/.env:/app/.env:ro" --name csdn-downloader d1caprio/csdn-downloader:latestAvailable tags:
d1caprio/csdn-downloader:latest: recommended default tagd1caprio/csdn-downloader:amd64: explicit AMD64/x86_64 build for Linux servers and Render
Docker Hub image note: The published image is a convenience packaging of this repository for self-hosted use. It is not a hosted download service and does not change the disclaimer above.
-
Build and run with Docker locally:
Make sure you have Docker installed.
docker build -t csdn-downloader . docker run -d -p 8181:8181 -v "$(pwd)/.env:/app/.env:ro" --name csdn-downloader csdn-downloader
Local Docker note: The sample
.envcan contain multi-line JSON forCSDN_COOKIE, so mounting the file is safer than--env-file.Render note: On Render, configure environment variables in the dashboard directly. The app falls back to process env when
.envis absent. If you prefer Render Secret Files, the container also checks/etc/secrets/.envbefore boot.Render checklist:
- Set
CSDN_COOKIE,CSDN_LINUXDO_ID,CSDN_LINUXDO_SECRET,CSDN_LINUXDO_CALLBACK,JWT_SECRET, andMONGO_URIin the Render dashboard. - Keep the default container start command from the Dockerfile.
- Set the health check path to
/healthz.
- Set
-
Run Locally:
go mod download go run .Access the frontend at
http://localhost:8181. -
Verify After Changes:
go test ./... bash scripts/smoke.sh
高性能 CSDN 资源自动下载器,集成了自动限流、权限认证以及现代化的前端界面。
- 本项目是一个开源的自部署工具,不是 CSDN 官方产品,也不提供任何官方或非官方托管服务。
- 本项目并非为了发现、利用、绕过或放大 CSDN 的任何漏洞、付费墙、访问控制、DRM 或安全机制而设计。
- 本仓库不提供任何公共下载服务、公共镜像、代理节点、共享账号或中心化下载接口;如需使用,必须由您在自己的环境中自行部署和运行。
- 本仓库维护者不会运营任何公开实例或公共下载服务。
- 本仓库不内置、不分发、不作为资源库长期托管任何 CSDN 资源内容;它只在部署者或最终用户自行提供配置的前提下,协调其自行发起的请求流程。
- 项目本身不维护资源库、不提供资源托管,也不以存储、沉淀、再分发资源内容为目标。任何由第三方部署引入的缓存、持久化、对象存储归档或再分发行为,均超出本仓库范围,并由对应部署者自行承担全部责任。
- 您必须使用自己的账号、Cookie、OAuth 凭证和基础设施,并自行确保使用行为符合 CSDN 的服务条款、版权要求、当地法律法规及其他适用义务。
- 如果您没有合法权限访问、下载、复制、传播或使用相关资源,请不要使用本项目进行该类操作。
- 自动下载:高效获取 CSDN 资源。
- 智能配额管理:
- 全局月度限额:全系统可配置的静态月度限额。
- 用户月度限额:基于信任等级(Level 0-3)的个人用户配额。
- 安全认证:通过 LinuxDO OAuth 进行安全登录。
- 现代化 UI:
- 极简主义设计,灵感来源于 Claude。
- 一键复制:下载链接直接展示,支持一键复制,防止误跳转。
- 实时仪表盘显示本月剩余配额。
- 交互式页脚包含社交链接。
- 稳健后端:基于 Go 语言构建,提供标准的 JSON API 响应和基于 JWT 的会话管理。
- 后端: Go (Golang)
- 数据库: MongoDB
- 前端: 原生 HTML/CSS/JS
- 认证: OAuth2 (LinuxDO), JWT
- 容器化: Docker
- Go 1.23+ (如果本地运行)
- 有效的 CSDN VIP 账号 Cookie JSON 数组
- LinuxDO OAuth 应用 凭证
- MongoDB 数据库 (或 MongoDB Atlas 连接串)
-
克隆仓库:
git clone <your-repo-url> cd CSDNAutoDownloader
-
配置环境 (.env):
复制示例配置文件并填写您的详细信息:
cp .env.example .env
打开
.env文件并配置以下变量(详见 配置说明)。 -
直接使用 Docker Hub 预构建镜像(部署推荐):
如果你不想本地构建,可以直接使用已经发布到 Docker Hub 的镜像:
docker pull d1caprio/csdn-downloader:latest docker run -d -p 8181:8181 -v "$(pwd)/.env:/app/.env:ro" --name csdn-downloader d1caprio/csdn-downloader:latest可用标签:
d1caprio/csdn-downloader:latest:默认推荐标签d1caprio/csdn-downloader:amd64:显式的 AMD64/x86_64 构建,适合 Linux 服务器和 Render
Docker Hub 镜像说明: 该镜像只是本仓库的便捷打包产物,便于用户自部署使用;它并不构成任何托管下载服务,也不改变上面的免责声明。
-
本地构建并使用 Docker 运行:
确保已安装 Docker。
docker build -t csdn-downloader . docker run -d -p 8181:8181 -v "$(pwd)/.env:/app/.env:ro" --name csdn-downloader csdn-downloader
本地 Docker 说明: 示例
.env里的CSDN_COOKIE可能是多行 JSON,所以本地更适合直接挂载.env文件,不建议用--env-file。Render 说明: 在 Render 里直接在控制台配置环境变量即可;如果容器里没有
.env,程序会自动回退到进程环境变量。 如果你更喜欢 Render Secret Files,容器启动时也会额外检查/etc/secrets/.env。Render 部署清单:
- 在 Render 控制台配置
CSDN_COOKIE、CSDN_LINUXDO_ID、CSDN_LINUXDO_SECRET、CSDN_LINUXDO_CALLBACK、JWT_SECRET、MONGO_URI。 - 保持 Dockerfile 默认启动命令,不要额外覆盖。
- 健康检查路径填写
/healthz。
- 在 Render 控制台配置
-
本地运行:
go mod download go run .访问
http://localhost:8181使用。 -
修改后校验:
go test ./... bash scripts/smoke.sh
Full list of configuration variables in .env:
| Variable / 变量名 | Description / 描述 | Default / 默认值 | Required / 必填 |
|---|---|---|---|
CSDN_COOKIE |
CSDN VIP Account Cookie JSON array with optional weight / 支持 weight 的 JSON 数组 Cookie 配置 |
- | ✅ |
PORT |
Service Port / 服务端口 | :8181 |
❌ |
CSDN_LINUXDO_ID |
OAuth Client ID | - | ✅ |
CSDN_LINUXDO_SECRET |
OAuth Client Secret | - | ✅ |
CSDN_LINUXDO_CALLBACK |
OAuth Callback URL / 回调地址 | http://localhost:8181/auth/callback |
❌ |
JWT_SECRET |
Secret for JWT signing / JWT签名密钥 | ... |
❌ |
LIMIT_LEVEL_0 |
Monthly limit for Trust Level 0 / 0级用户月限额 | 1 |
❌ |
LIMIT_LEVEL_2 |
Monthly limit for Trust Level 2 / 2级用户月限额 | 3 |
❌ |
LIMIT_LEVEL_3 |
Monthly limit for Trust Level 3 / 3级用户月限额 | 5 |
❌ |
GLOBAL_MONTHLY_LIMIT |
System-wide monthly download limit / 系统全局月下载限额 | 50 |
❌ |
MONGO_URI |
MongoDB Connection URI / MongoDB连接串 | - | ✅ |
Example CSDN_COOKIE value:
CSDN_COOKIE='[{"value":"cookie1_string","weight":10},{"value":"cookie2_string","weight":1}]'POST /v1/download: Submit download request, requiresauth_tokencookie / 提交下载请求,需要auth_tokenCookieGET /v1/limit: Get global quota, requiresauth_tokencookie / 获取全局配额,需要auth_tokenCookieGET /v1/monthly_limit: Get user quota, requiresauth_tokencookie / 获取用户配额,需要auth_tokenCookieGET /healthz: Readiness check, returns200only when Mongo is reachable / 就绪检查,仅当 Mongo 可达时返回200GET /auth/login: LinuxDO Login / LinuxDO 登录GET /auth/callback: LinuxDO OAuth callback / LinuxDO OAuth 回调GET /oauth2/callback: LinuxDO OAuth callback alias / LinuxDO OAuth 回调别名
- Yicheng
- Powered by LinuxDO OAuth, with thanks to the LINUX DO community / 基于 LinuxDO OAuth 接入,特别鸣谢 LINUX DO 社区
- Follow me on LinuxDO and GitHub.
This project is open-sourced under the MIT License.