Files
wehub-resource-sync 9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:48 +08:00

63 lines
2.4 KiB
Markdown

# WeChat (微信公众号)
**Mode**: 🌐 / 🔐 Browser · **Domains**: `weixin.sogou.com`, `mp.weixin.qq.com`
## Commands
| Command | Description |
|---------|-------------|
| `opencli weixin search` | 使用搜狗微信搜索公众号文章,返回标题、链接、摘要和发布时间 |
| `opencli weixin download` | 下载微信公众号文章为 Markdown 格式 |
| `opencli weixin drafts` | 列出公众号后台草稿箱中的图文草稿 |
| `opencli weixin create-draft` | 在公众号后台创建新的图文草稿 |
## Usage Examples
```bash
# Search Official Account articles through Sogou Weixin
opencli weixin search "AI" --page 1 --limit 5
# Export the corresponding WeChat article URL to Markdown
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --output ./weixin
# Export article to Markdown
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --output ./weixin
# Export with locally downloaded images
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --download-images
# Export without images
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --no-download-images
# List the latest drafts
opencli weixin drafts --limit 5
# Create a draft article
opencli weixin create-draft --title "周报" --author "OpenCLI" --summary "本周更新摘要" "这里是正文内容"
# Create a draft with a cover image sourced from local disk
opencli weixin create-draft --title "封面示例" --cover-image ./cover.png "正文会先插入图片,再设为封面"
```
## Output
`search` returns one row per Sogou Weixin result:
- `rank` — overall result rank based on the requested page
- `page` — Sogou result page number
- `title` — article title
- `url` — Sogou result link for the article
- `summary` — result-page snippet, when available
- `publish_time` — time text rendered by Sogou, such as `27分钟前` or `2小时前`
Use `weixin download` with the corresponding `mp.weixin.qq.com` article URL when you need Markdown content extraction.
Downloads to `<output>/<article-title>/`:
- `<article-title>.md` — Markdown with frontmatter (title, author, publish time, source URL)
- `images/` — Downloaded images (if `--download-images` is enabled, default: true)
## Prerequisites
- Chrome running and **logged into** mp.weixin.qq.com (for articles behind login wall)
- [Browser Bridge extension](/guide/browser-bridge) installed
- `create-draft` with `--cover-image` requires Browser Bridge file upload support