douban-sync-skill
导出并同步豆瓣个人收藏(书籍、影视、音乐、游戏)到本地CSV文件。该技能帮助用户管理和备份豆瓣数据,支持增量同步,方便在Obsidian等工具中整理个人阅读、观影、听歌和游戏历史,实现数据本地化和自动化更新,告别手动记录的繁琐。
git clone https://github.com/cosformula/douban-sync-skill.gitBefore / After 效果对比
1 组以前手动记录或截图豆瓣收藏,数据分散且难以整理,无法方便地在本地进行管理和分析,更新耗时耗力,容易遗漏最新动态。
现在通过自动化脚本将豆瓣收藏导出为CSV,并每日增量同步,数据统一存储,便于在Obsidian等工具中高效管理和回顾,确保数据最新且易于检索。
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
用户评价 (0)
发表评价
暂无评价
统计数据
用户评分
为此 Skill 评分