Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
8435ab7
更新说明文档
champkeh Oct 19, 2023
8f58200
更新脚本
champkeh Oct 20, 2023
2309d07
update
champkeh Oct 22, 2023
8a31000
update
champkeh Oct 22, 2023
0bd9a9b
update
champkeh Oct 22, 2023
aeb0b86
Update issue templates
champkeh Oct 23, 2023
6a8b129
Update issue templates
champkeh Oct 23, 2023
24325f2
Update issue templates
champkeh Oct 23, 2023
d098fcb
添加跳转微信读书阅读页面按钮
champkeh Oct 23, 2023
3e6ce04
Merge branch 'master' of github.com:champkeh/wereadx
champkeh Oct 23, 2023
a0e52e9
优化日志
champkeh Oct 24, 2023
ab9509f
测试京东读书接口
champkeh Oct 27, 2023
5f56129
测试京东读书接口
champkeh Oct 27, 2023
a0f15d6
添加京东读书下载工具
champkeh Oct 27, 2023
7a30112
调整章节之间的下载间隔为2秒
champkeh Oct 27, 2023
4eb26d5
修复进度提示错误的bug,优化下载间隔
champkeh Oct 28, 2023
97cc8f1
优化格式判断
champkeh Oct 28, 2023
885f52d
优化图片样式
champkeh Oct 28, 2023
480a400
优化图片样式
champkeh Oct 28, 2023
a3915e9
合并相邻span元素,优化尺寸
champkeh Oct 29, 2023
7ab2a90
update
champkeh Oct 29, 2023
7202417
update
champkeh Oct 29, 2023
04816a0
更新脚本,方便本地运行
champkeh Oct 29, 2023
82fc0b2
本地运行不再需要配置环境变量
champkeh Oct 29, 2023
9618410
update
champkeh Oct 29, 2023
97bebc0
Update issue templates
champkeh Oct 29, 2023
34dfcc6
优化前端代码
champkeh Oct 29, 2023
2cd1619
Merge branch 'master' of github.com:champkeh/wereadx
champkeh Oct 29, 2023
de42890
优化下载
champkeh Oct 29, 2023
0a7fbd9
优化前端代码
champkeh Oct 30, 2023
e22b43e
优化前端代码
champkeh Oct 30, 2023
10477ba
优化打包速度
champkeh Oct 30, 2023
a3c6f3b
优化图片样式
champkeh Oct 30, 2023
05ca578
update
champkeh Oct 30, 2023
837e087
测试插件
champkeh Oct 30, 2023
6800c0f
测试插件跨域下载资源
champkeh Oct 30, 2023
0280806
初步支持下载epub格式
champkeh Oct 30, 2023
d30e8f7
临时调整下载次数限制为30 (测试epub)
champkeh Oct 30, 2023
5d7c6ae
update
champkeh Oct 30, 2023
7f6e619
update
champkeh Oct 30, 2023
9a1b48b
update
champkeh Oct 30, 2023
a7c153f
优化 epub 注释
champkeh Oct 31, 2023
1edb7af
优化 epub 格式
champkeh Oct 31, 2023
7899214
优化 epub 格式
champkeh Oct 31, 2023
47844e0
epub格式抽取公共样式和脚本到单独文件
champkeh Oct 31, 2023
9598179
优化 epub 元数据
champkeh Oct 31, 2023
ce58841
添加 DATABASE_URL 获取说明
champkeh Nov 1, 2023
f05cc2e
fix: 修复 Windows 上下载时报错的bug
champkeh Nov 1, 2023
4ad61a1
Update issue templates
champkeh Nov 1, 2023
6596e2c
Update issue templates
champkeh Nov 1, 2023
5c861d7
Update issue templates
champkeh Nov 1, 2023
faeb534
添加 stargazers
champkeh Nov 1, 2023
ec38c33
fix: 修复epub格式问题
champkeh Nov 1, 2023
9f52fbd
修复详情页章节列表的样式
champkeh Nov 2, 2023
05395d1
update
champkeh Nov 2, 2023
9c4b974
优化目录层级
champkeh Nov 2, 2023
5c37b64
Merge pull request #28 from champkeh/fix-toc
champkeh Nov 2, 2023
d933a70
优化自动阅读
champkeh Nov 5, 2023
6aa2d4b
添加接口失败日志记录
champkeh Nov 5, 2023
7821e0b
优化详情页目录样式
champkeh Nov 5, 2023
89c6ecf
优化详情页目录样式
champkeh Nov 5, 2023
466ed5a
fixbug
champkeh Nov 5, 2023
d24af0d
fixbug
champkeh Nov 5, 2023
ab32c33
fixbug
champkeh Nov 5, 2023
cf8425a
fixbug
champkeh Nov 5, 2023
59ae777
优化网站样式
champkeh Nov 5, 2023
7eb75d6
update readme
champkeh Nov 5, 2023
39632f2
update readme
champkeh Nov 5, 2023
d7ff62c
update readme
champkeh Nov 5, 2023
516f460
update readme
champkeh Nov 5, 2023
c7bdfc6
替换cdn地址
champkeh Nov 6, 2023
8e3f1f0
增加邮箱绑定
champkeh Nov 6, 2023
dca0862
增加邮箱绑定
champkeh Nov 6, 2023
dd4eb4d
更新readme
champkeh Nov 6, 2023
6597320
更新readme
champkeh Nov 6, 2023
0a82fab
update
champkeh Nov 7, 2023
0f62939
update
champkeh Nov 7, 2023
e191097
优化任务执行
champkeh Nov 7, 2023
ce6769f
优化任务执行
champkeh Nov 7, 2023
e31179d
优化任务执行
champkeh Nov 7, 2023
9d345c3
优化任务执行
champkeh Nov 7, 2023
be1bfba
优化任务执行
champkeh Nov 7, 2023
e28ba87
修复bug
champkeh Nov 7, 2023
4640a00
修复本地运行报错的bug
champkeh Nov 7, 2023
225c5f1
调整下载间隔
champkeh Nov 7, 2023
0770373
调整下载间隔为2500~4500
champkeh Nov 7, 2023
ce2dfc1
修复bug
champkeh Nov 7, 2023
c725d3e
update
champkeh Nov 7, 2023
11e2e1d
update
champkeh Nov 8, 2023
b486040
更新readme
champkeh Nov 8, 2023
34527fd
调整自动阅读触发时间
champkeh Nov 8, 2023
d334a87
update
champkeh Nov 8, 2023
64b6df2
update
champkeh Nov 8, 2023
48cbfb1
添加一篇原理解释文档
champkeh Nov 8, 2023
277a4aa
优化epub图片下载
champkeh Nov 8, 2023
cd916d5
调试
champkeh Nov 8, 2023
dc7f8e3
调试
champkeh Nov 8, 2023
5080e47
优化epub图片打包进度提示
champkeh Nov 9, 2023
80e3937
update
champkeh Nov 9, 2023
b36e32d
Merge branch '88825:master' into master
weslywang Nov 19, 2023
774ffa2
update
Nov 21, 2023
847821a
update time interval
Nov 21, 2023
849fd25
much more images error
Dec 9, 2023
75cd68f
update
Dec 9, 2023
3a55111
update
Dec 9, 2023
7133d2d
update
Dec 9, 2023
416b11a
update
Dec 16, 2023
78d8b64
update
Dec 16, 2023
71af110
add download pause
Dec 25, 2023
a3238c0
update
Dec 25, 2023
f644d31
update
kingcodexl Nov 22, 2024
ccd7657
update
kingcodexl Nov 27, 2024
1bf8def
update
kingcodexl Nov 28, 2024
67d2733
refactor(frontend): comment out sensitive information in detail page
kingcodexl Apr 4, 2025
946dd1f
feat(frontend): simulate human reading behavior in chapter downloads
kingcodexl May 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**请详细描述一下遇到的问题**

**期望的结果**

**书籍BookID**
如果涉及到特定书籍,请提供书籍的 bookId;
如果下载的书有格式错误,请提供一份有问题的文件方便调试

**运行平台**

**使用的阅读器及版本**
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**请详细描述一下你想要的功能**
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.husky/pre-push
.DS_Store
node_modules
download
test
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}
155 changes: 130 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,146 @@
# wereadx

微信读书辅助工具,基于微信读书网页版开发的额外功能
微信读书辅助工具,数据来自于微信读书网页版

## 声明
**本软件只能下载用户可访问的书籍,不支持下载需付费才能查看的书籍,请勿用于非法用途!本软件作者不对滥用行为承担任何赔偿责任。**

## ⚠️警告⚠️
- **不要同时下载多本书,不但容易下载失败,还可能导致被微信读书封号处理!!!**
- **尽量不要下载超过 200 章的书,很容易被检测到然后封号**
- **本工具可靠性已经不能保证,很容易被检测到,尽量不要再用了**

## 功能列表

1. 下载书架上的书到本地,目前仅支持下载 html 格式
1. 下载书架上的书到本地,仅支持下载 **html** 和 **epub** 格式
2. 自动更新阅读时长,可用于刷“读书排行榜”或者“阅读挑战赛”
3. 每周日晚 23:30 自动领取“时长兑福利”中的免费体验卡(暂未对外开放)
4. 支持下载用户上传的 pdf 格式的书(不计入下载次数限制,因为走的是外部的流量)
4. 支持下载用户自己上传的 pdf 格式的书

> 如果需要更多功能,可以在issue区讨论

## 本地运行

## 环境变量说明
请在项目根目录下新建`.env`文件,存放以下环境变量:
```
# Supabase 数据库连接字符串
DATABASE_URL=
> 需要提前安装 deno,参考官方的[安装指南](https://docs.deno.com/runtime/manual/getting_started/installation)

# Deno KV Access Token
DENO_KV_ACCESS_TOKEN=

# Deno KV UUID
DENO_KV_UUID=
```shell
deno task dev
```
或者
```shell
npm run dev
```
或者
```shell
yarn dev
```


## 部署指南

> 如果想要自己部署,可参考以下步骤进行部署,目前仅支持部署到 Deno Deploy。
> 如果不想自己部署,可以使用 https://weread.deno.dev 公共服务,但有会限制,比如下载次数限制为每月100次,不支持自动领取体验卡等。
> 如果不想自己部署,可以使用 https://weread.deno.dev 公共服务,但会有限制,比如下载次数限制为每月100次,不支持自动领取体验卡等。

### 1. fork 本项目

### 2. 在根目录创建`.env`文件,内容按照上面的说明填写

### 3. 新建 Deno Deploy 项目,配置如下:
### 2. 新建 Deno Deploy 项目,配置如下:
![项目配置](assets/setup.png)

### 4. 部署完成,在 Deno Deploy 的设置页面,添加环境变量
### 3. 部署完成,在 Deno Deploy 的设置页面,添加环境变量

| 变量名 | 功能 | 是否必填 |
|----------------|-----------------------------------------------|---------------|
| DEPLOY_DOMAIN | 最终部署的域名,格式为: `https://xxx.deno.dev`,与发送提醒邮件有关 | 需要自动阅读暂停提醒时必填 |
| RESEND_API_KEY | 用于发送邮件,格式为: `re_xxx` | 需要自动阅读暂停提醒时必填 |
| RESEND_DOMAIN | Resend 配置的域名,不含`https://`前缀 | 需要自动阅读暂停提醒时必填 |
| DATABASE_URL | 记录日志,格式为: `postgresql://xxx` | 选填 |
| CRON_KEY | cron任务的key (自定义的随机字符串,在下面的触发器任务中使用) | 使用cron任务时必填 |


<details>
<summary>获取 RESEND_API_KEY 和 RESEND_DOMAIN</summary>

注册 https://resend.com/ 账号,然后添加一个 API key,如下图:

![resend api key](assets/resend-api-key1.png)
![resend api key](assets/resend-api-key2.png)


想要正常发送邮件,还需要配置域名
![resend domain](assets/resend-domain1.png)
![resend domain](assets/resend-domain2.png)

按照这个配置你的域名,最终效果如下:
![resend domain result](assets/resend-domain-result.png)
</details>


<details>
<summary>获取 DATABASE_URL</summary>

注册 https://supabase.com/ 账号,创建一个新的项目,如下图:

![创建一个数据库项目](assets/new-database-project.png)

> **保存这个数据库密码,后面连接字符串需要使用**

等待项目创建成功后,进入**Project Settings**里面的**Database**:

![数据库配置入口](assets/database-entry.png)

找到 **连接字符串** 面板,切换到`URI`,这个就是`DATABASE_URL`。注意需要用上面保存的数据库密码替换里面的`[YOUR-PASSWORD]`部分。

![连接字符串](assets/connect-string.png)
</details>

完整的环境变量配置如下:

![环境变量配置](assets/env.png)

### 4. 设置定时任务
自动阅读和兑换体验卡都需要定时任务来触发执行,目前deno deploy自己的消息队列不太好用,所以采用 cloudflare 的 worker 来作为定时任务的触发器。

#### 自动阅读的触发器
在 CloudFlare 控制台添加一个 worker,代码如下:
```js
export default {
async scheduled(event, env, ctx) {
// 注意:此处的域名替换成你自己部署的域名,CRON_KEY 替换成上面环境变量配置的 CRON_KEY
const resp = await fetch('https://[your.domain.com]/cron/read/v2?key=[CRON_KEY]')
console.log(await resp.text())
},
};
```
设置 cron 触发周期为 `*/30 19-21 * * *`(北京时间每天凌晨3点到凌晨6点,中间每隔30分钟更新一次),如下图所示:
![自动阅读的触发器](assets/cron-read.png)

#### 自动兑换体验卡的触发器
worker代码如下:
```js
export default {
async scheduled(event, env, ctx) {
// 注意:此处的域名替换成你自己部署的域名,CRON_KEY 替换成上面环境变量配置的 CRON_KEY
const resp = await fetch('https://[your.domain.com]/cron/exchange-awards?key=[CRON_KEY]')
console.log(await resp.text())
},
};
```
触发周期设置为 `30 15 * * sun`(北京时间每周日晚11点30分),如下图所示:
![兑换体验卡的触发器](assets/cron-exchange.png)


### 5. 后续更新操作
如果发现 fork 的版本比源版本落后,需要更新到最新版本时,只需要在 github 更新仓库代码即可,不需要删除 deploy 上面的项目重新 fork。

![fork版本是最新版本](assets/fork-is-latest.png)
上面这个图表示当前 fork 的代码是最新版本,不需要更新。

![fork版本是落后版本](assets/fork-is-behind.png)
上面这个图表示当前 fork 的代码落后源版本1个版本,可以点击右边的**Sync fork**更新代码,如下图所示:

![更新fork版本](assets/update-fork.png)

更新完之后,deploy 上面会自动重新部署最新版本。


## 特别注意

Expand All @@ -54,13 +155,17 @@ DENO_KV_UUID=

![登录时二次确认](assets/login.png)

这个应该是属于微信读书的bug,后续如果微信读书调整的话,我会跟进处理这个问题
这个应该是属于微信读书的bug,后续如果微信读书调整的话,我再跟进处理这个问题


## 后续计划

- 修复部分图片无法加载的问题;
- 美化网站样式;
- 添加更多微信读书API,比如导出笔记、书评等;
- 支持下载更多电子书格式,比如 epub/azw3 等,[可以关注这个issue。](https://github.com/champkeh/wereadx/issues/2)
- 加入搜索功能,方便下载非书架上的书(因为[技术限制](https://github.com/champkeh/wereadx/issues/3),并不保证能搜索到所有的书)。
- 解决 issue 中的 bug 及提出的优化点;
- 优化网站样式;
- 优化 epub 格式;
- <del>导出书籍中的的笔记/划线;</del>


## Stargazers over time

[![Stargazers over time](https://starchart.cc/champkeh/wereadx.svg)](https://starchart.cc/champkeh/wereadx)
Binary file added assets/connect-string.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cron-exchange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cron-read.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/database-entry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/env.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fork-is-behind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fork-is-latest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/new-database-project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/resend-api-key1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/resend-api-key2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/resend-domain-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/resend-domain1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/resend-domain2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/update-fork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"nodeModulesDir": "auto",
"tasks": {
"dev": "deno run -A --unstable --unstable-kv src/server.ts local",
"serve": "deno run -A --unstable --unstable-kv src/server.ts"
},
"imports": {
"crypto-js": "npm:crypto-js@4.2.0",
"xss": "npm:xss@1.0.14",
"parse5": "npm:parse5@7.1.2"
}
}
Loading