A modern, fast, and stable GitHub Action to sync your Douban (豆瓣) marked data to JSON files.
This project is inspired by and rewritten from lizheming/doumark-action. It drops legacy dependencies, runs on a modern Python environment, and preserves 100% of the original data structure, ensuring zero downstream breakage for your blogs or display pages.
- Full Synchronization: Automatically paginates and fetches all your marked records (even 800+ items).
- 100% Backward Compatible: Preserves the exact same JSON structure as the original
doumark-action, including redundant fields and color schemes. - Modern & Fast: Built with Python 3.12 and
httpx, abandoning outdated Node.js legacy code. - Stable Strategy: Implements polite request intervals and proper HTTP configurations for stable, long-term synchronization.
Create a workflow file in your repository (e.g., .github/workflows/douban.yml) and add the following configuration:
name: douban sync
on:
schedule:
- cron: "0 1 * * *" # Runs every day at 09:00 (UTC+8)
workflow_dispatch:
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
# Clean up old data before syncing
- name: Reset data directory
shell: bash
run: |
rm -rf ./data
mkdir -p ./data
# Run Douban Sync Action
- name: Movie Sync
uses: somkanel/douban-sync-action@v1.0.0
with:
id: sampleid # Your Douban user ID
type: movie # Currently supports 'movie'
format: json # Output format
dir: ./data # Output directory
env:
DOUBAN_COOKIE: ${{ secrets.DOUBAN_COOKIE }} # Your Douban Cookie
# Use native Git commands to commit and push
- name: Commit and Push
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add ./data
if ! git diff-index --quiet HEAD; then
git commit -m "chore: sync douban movie data"
git push
echo "Changes pushed successfully."
else
echo "No changes to commit."
fi
| Input | Description | Required | Default |
|---|---|---|---|
id |
Your Douban user ID | Yes | somkanel |
type |
Type of data (movie, book, etc.) |
No | movie |
format |
Output format (currently only json) |
No | json |
dir |
Directory to save the output file | No | ./data |
You must provide your Douban Cookie via the env context.
| Env Variable | Description | Required |
|---|---|---|
DOUBAN_COOKIE |
Your Douban login cookie (stored in GitHub Secrets) | Yes |
How to get the cookie:
- Log in to douban.com in your browser.
- Open Developer Tools (F12) -> Application/Storage -> Cookies.
- Copy the entire cookie string (must include
dbcl2).- Save it to your repository's Settings -> Secrets and variables -> Actions as
DOUBAN_COOKIE.
The original doumark-action is a great project, but it hasn't been updated for years. It relies on deprecated Node.js 16/20 environments, throwing warnings in modern GitHub Actions.
This rewrite:
- Solves the
Node.js 20 actions are deprecatedwarning. - Fixes the
Unexpected input 'cookie'error by moving cookies to environment variables. - Uses Python instead of Shell/Docker nesting for easier future maintenance.
This action is for personal data backup only. Please use it reasonably and follow the platform's terms of service.
MIT License