Fetch articles from WeChat public accounts (微信公众号) via a WeRSS API server and save them as Markdown files with YAML frontmatter.
- Fetches articles from WeChat public accounts through WeRSS API
- Converts HTML to clean Markdown with YAML frontmatter
- Incremental sync — tracks fetched/failed articles, skips duplicates, retries failures
- Parallel fetching with concurrency control (max 3 simultaneous)
- Graceful shutdown on Ctrl+C — finishes current article, state is preserved
- Configurable via CLI flags, environment variables, or TOML config file
- Optional workspace publishing with cover image downloads
- Date range filtering and article count limits
- Secure token management — automatic credential storage and refresh with system keyring
- Interactive authentication — falls back to password prompt when needed
./target/release/werss-cli --api-base http://your-server:8001 \
--username your-username \
--password your-password \
--mp all→ Credentials are validated and token is automatically saved to system keyring
./target/release/werss-cli --mp all→ Token is automatically loaded from keyring, no credentials needed
- Check system keyring for existing token
- If found and valid → use immediately
- If found but expired → automatically refresh
- If refresh fails or no token → use provided credentials or prompt for password
- Token is automatically saved for next run
cargo build --release
# generate config template
./target/release/werss-cli --init-config
# edit werss.toml with your API credentials, then run
./target/release/werss-cliCLI flags > Environment variables > werss.toml > .env > Built-in defaults
Minimal werss.toml:
[api]
base = "http://your-server:8001"
username = "your-username"
password = "your-password"
[sync]
target_mps = "all" # or ["MP_WXS_123", "MP_WXS_456"]werss-cli # fetch all (uses werss.toml + saved token)
werss-cli --mp MP_WXS_123,MP_WXS_456 # specific accounts
werss-cli --output ./data # custom output directory
werss-cli --since 2026-01-01 --until 2026-03-31 # date range
werss-cli --limit 10 # max 10 articles
werss-cli --workspace ./workspace # publish to workspace| Page | Description |
|---|---|
| Installation | Build from source, binary releases |
| Configuration | CLI flags, env vars, werss.toml reference |
| Usage Guide | Common workflows and examples |
| Incremental Sync | State tracking and retry behavior |
| Output Format | Directory structure, frontmatter, workspace |
| Architecture | Module design, data flow, concurrency model |
| API Reference | WeRSS API endpoints used by the CLI |
| Troubleshooting | Error messages, common issues, FAQ |
Articles are saved as:
articles/{mp_id}/YYYYMMDD/{seq}/{slug}.md
Each file has YAML frontmatter (title, author, coverImage, url, mp_id, description, publish_time) followed by the converted Markdown body.
- reqwest — HTTP client
- tokio — async runtime
- clap — CLI argument parsing
- html-to-markdown-rs — HTML to Markdown conversion
- serde / serde_json — serialization
- chrono — date/time handling
- toml — config file parsing
- anyhow — error handling
- keyring — secure credential storage (cross-platform)
- regex — HTML image URL extraction
- futures — async utilities
MIT