Files
storyforge/scripts/douyin-browser-capture/README.md

53 lines
1.6 KiB
Markdown

# Douyin Browser Capture
This tool drives a real Playwright Chromium session, lets a human log into Douyin, captures the loaded profile and work pages, and can sync the captured bundle into StoryForge's existing `/v2/douyin/accounts/sync` endpoint.
## Install
```bash
cd /Users/kris/code/StoryForge-gitea/scripts/douyin-browser-capture
npm install
npx playwright install chromium
```
## Run
```bash
cd /Users/kris/code/StoryForge-gitea/scripts/douyin-browser-capture
npm run capture -- \
--profile-url https://www.douyin.com/user/your_account \
--storyforge-username kris \
--storyforge-password 'Asd123456.'
```
The browser uses a persistent state directory under `~/.storyforge/douyin-playwright`, so Douyin login can survive between runs.
## What it captures
- current profile page JSON blobs extracted from `<script>` tags
- selected window globals such as `__INITIAL_STATE__`
- relevant JSON network responses
- creator-center pages using the same logged-in browser context
- a limited number of video detail pages linked from the profile
## Output
Default output directory:
`/Users/kris/code/StoryForge-gitea/output/playwright/douyin`
Each run writes:
- `profile-bundle.json`
- `creator-*.json`
- `video-*.json`
- `storyforge-sync-request.json`
- `storyforge-sync-response.json` when sync is enabled
- `summary.json`
## Notes
- This is designed as a browser-assisted capture flow, not a fully headless anti-bot bypass.
- If Douyin shows a slider or challenge page, solve it manually in the opened browser window and then continue.
- Use `--no-sync` if you only want to save a local bundle for inspection.