admin ec88707e6b fix: close thoughts page and modal when switching nav tabs
switchTab() now checks if the thoughts detail page or book detail modal
is open and closes them before switching to the target tab. Previously,
when on the thoughts page, clicking any nav tab (charts, ranking, etc.)
would silently fail because mainView was still hidden.
2026-07-17 12:17:10 +08:00
2026-07-17 09:59:37 +08:00
2026-07-17 09:59:37 +08:00

微信读书数据展示网站

基于微信读书 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. 设置环境变量

export WEREAD_API_KEY=wrk-xxxxxxxx  # 你的微信读书 API Key

2. 安装依赖

pip install -r requirements.txt

3. 采集数据

python fetch_data.py

将拉取书架、阅读统计、笔记等数据并存入 weread.db。

4. 启动网站

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 即可刷新本地数据。

S
Description
No description provided
Readme
1.6 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 42.4%
JavaScript 25.8%
CSS 24.4%
HTML 5.2%
Shell 2.2%