Files
WeReadBoard/README.md
T
admin 1e9c537b86 feat: init weread data dashboard
- 数据采集脚本 fetch_data.py:从微信读书 API 拉取书架、阅读统计、笔记数据存入 SQLite
- Flask 后端 app.py:提供 8 个 API 接口(总览、年度趋势、读书排行、偏好分类、偏好作者、时段分布、书架、笔记)
- 前端页面:ECharts 图表(年度趋势、时段分布、分类饼图、作者排行)、书架网格、笔记概览
- 数据规模:404 本书架、339 小时阅读、304 天阅读、1709 条笔记
2026-07-17 09:59:37 +08:00

81 lines
2.1 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.
# 微信读书数据展示网站
基于微信读书 API 的个人读书数据展示网站,数据存储在本地 SQLite 数据库中。
## 项目结构
```
.
├── fetch_data.py # 数据采集脚本(从微信读书 API 拉取数据到 SQLite)
├── app.py # Flask 后端服务
├── weread.db # SQLite 数据库(运行 fetch_data.py 后生成)
├── requirements.txt # Python 依赖
├── templates/
│ └── index.html # 前端页面
└── static/
├── css/style.css # 样式文件
└── js/app.js # 前端逻辑
```
## 快速开始
### 1. 设置环境变量
```bash
export WEREAD_API_KEY=wrk-xxxxxxxx # 你的微信读书 API Key
```
### 2. 安装依赖
```bash
pip install -r requirements.txt
```
### 3. 采集数据
```bash
python fetch_data.py
```
将拉取书架、阅读统计、笔记等数据并存入 `weread.db`。
### 4. 启动网站
```bash
python app.py
```
访问 http://127.0.0.1:8080 即可查看读书数据展示。
## 功能模块
| 模块 | 说明 |
|------|------|
| 总览仪表盘 | 累计阅读时长、阅读天数、书架藏书数、笔记总数 |
| 年度趋势图 | 各年度阅读时长柱状图 |
| 时段分布 | 24 小时阅读时段分布折线图 |
| 偏好分类 | 阅读分类占比饼图 |
| 偏好作者 | 阅读最多的作者排行 |
| 读书排行 | 阅读时长最久的书籍 TOP 20 |
| 书架 | 全部书架书籍展示,支持分类筛选和已读完筛选 |
| 笔记概览 | 有笔记的书籍及划线/想法/书签统计 |
## 数据库表结构
| 表名 | 说明 |
|------|------|
| books | 书架书籍信息 |
| reading_stats | 阅读统计概要(overall/annually) |
| read_times | 阅读时长时间序列 |
| read_longest | 阅读时长最久的书籍 |
| prefer_categories | 偏好分类 |
| prefer_authors | 偏好作者 |
| prefer_time | 24 小时阅读时段分布 |
| notebooks | 笔记本概览 |
| read_stat_items | 阅读统计摘要项 |
| archives | 书单/归档 |
## 更新数据
随时重新运行 `python fetch_data.py` 即可刷新本地数据。