douban-sync-skill
Export and synchronize your Douban personal collections (books, movies/TV, music, games) to local CSV files. This feature helps users manage and back up their Douban data, supports incremental synchronization, and facilitates organizing personal reading, viewing, listening, and gaming history in tools like Obsidian. It achieves data localization and automated updates, bidding farewell to the tediousness of manual recording.
git clone https://github.com/cosformula/douban-sync-skill.gitBefore / After Comparison
1 组Previously, Douban collections were manually recorded or screenshotted, leading to scattered and difficult-to-organize data. It was inconvenient to manage and analyze locally, updates were time-consuming and labor-intensive, and it was easy to miss the latest updates.
Now, Douban collections are exported to CSV via an automated script and incrementally synchronized daily. Data is stored uniformly, facilitating efficient management and review in tools like Obsidian, ensuring data is up-to-date and easily retrievable.
name: douban-sync description: Export and sync Douban (豆瓣) book/movie/music/game collections to local CSV files (Obsidian-compatible). Use when the user wants to export their Douban reading/watching/listening/gaming history, set up incremental sync via RSS, or manage their Douban data locally. metadata: {"openclaw": {"requires": {"env": ["DOUBAN_USER"]}, "primaryEnv": "DOUBAN_USER"}}
Douban Sync
Export Douban collections (books, movies, music, games) to CSV and keep them in sync via RSS.
Two Modes
1. Full Export (first time)
Use the browser tool to scrape all collection pages. Requires the user to be logged into Douban.
browser → douban.com/people/{USER_ID}/{category}?start=0&sort=time&mode=list
Categories and URL paths:
- Books:
book.douban.com/people/{ID}/collect(读过),/do(在读),/wish(想读) - Movies:
movie.douban.com/people/{ID}/collect(看过),/do(在看),/wish(想看) - Music:
music.douban.com/people/{ID}/collect(听过),/do(在听),/wish(想听) - Games:
www.douban.com/people/{ID}/games?action=collect(玩过),=do(在玩),=wish(想玩)
Each page shows up to 30 items in list mode (some pages may have fewer due to delisted entries). Paginate with ?start=0,30,60... — the script uses the paginator's "next" button to determine whether to continue.
Rate limiting: Wait 2-3 seconds between pages. If blocked, wait 30 seconds and retry.
Scripts:
scripts/douban-scraper.mjs— HTTP-only, no browser needed (may get rate-limited)scripts/douban-browser-scraper.mjs— via Puppeteer CDP, needs a running browserscripts/douban-extract.mjs— generates a browser console script for manual extraction
2. Incremental Sync (daily, via RSS)
Run scripts/douban-rss-sync.mjs — no login needed.
node scripts/douban-rss-sync.mjs
Setup: Set environment variables:
DOUBAN_USER(required): Douban user IDDOUBAN_OUTPUT_DIR(optional): Output root directory, default~/douban-sync
Recommended: Add a daily cron job for automatic sync.
Output Format
Four CSV files per user in the output directory:
douban-sync/
└── {user_id}/
├── 书.csv
├── 影视.csv
├── 音乐.csv
└── 游戏.csv
CSV columns:
title,url,date,rating,status,comment
"书名","https://book.douban.com/subject/12345/","2026-01-15","★★★★★","读过","短评内容"
status: 读过/在读/想读, 看过/在看/想看, 听过/在听/想听, 玩过/在玩/想玩
Deduplication
Both full export and RSS sync deduplicate by Douban URL — safe to run multiple times.
--- README.md ---
douban-sync-skill
豆瓣书影音游戏标记数据导出与增量同步工具。支持全量导出和 RSS 增量同步,输出 CSV 格式。
可作为 OpenClaw / AgentSkills 的 skill 使用,也可独立运行。
功能
- 全量导出:抓取豆瓣个人主页的所有标记数据(书、影视、音乐、游戏)
- 增量同步:通过 RSS 每日同步新标记,无需登录
- CSV 输出:结构化数据,方便导入 Excel/Obsidian/数据库
- 多用户支持:按用户 ID 分目录存储
- 去重:按 URL 去重,多次运行安全
输出格式
douban-sync/
└── {user_id}/
├── 书.csv
├── 影视.csv
├── 音乐.csv
└── 游戏.csv
CSV 列:title,url,date,rating,status,comment
安装
Via npx skills (any agent)
npx skills add cosformula/douban-sync-skill
Via ClawHub (OpenClaw)
clawhub install douban-sync-skill
Manual
git clone https://github.com/cosformula/douban-sync-skill.git
使用
增量同步(推荐日常使用)
DOUBAN_USER=your_douban_id node scripts/douban-rss-sync.mjs
环境变量:
DOUBAN_USER(必填):豆瓣用户 IDDOUBAN_OUTPUT_DIR(可选):输出根目录,默认~/douban-sync。文件会写入$DOUBAN_OUTPUT_DIR/$DOUBAN_USER/下
全量导出
# HTTP 直接抓取(可能被限速)
DOUBAN_USER=your_douban_id node scripts/douban-scraper.mjs
# 通过浏览器 CDP 抓取(需要 puppeteer-core + 已登录的浏览器)
DOUBAN_USER=your_douban_id node scripts/douban-browser-scraper.mjs
从 Markdown 迁移到 CSV
如果之前用的是 Markdown 格式的导出数据:
DOUBAN_USER=your_douban_id node scripts/migrate-md-to-csv.mjs
安全注意事项
douban-browser-scraper.mjs通过 CDP 连接本地浏览器(默认http://127.0.0.1:18800),仅在你自己启动的本地浏览器上使用,不要暴露调试端口到网络- 如果只需要增量同步,
douban-rss-sync.mjs不需要登录,风险最低
作为 OpenClaw Skill 使用
将此目录放在 OpenClaw workspace 的 skills/ 下即可自动识别。
License
MIT
User Reviews (0)
Write a Review
No reviews yet
Statistics
User Rating
Rate this Skill