Files
jackwener__opencli/docs/adapters/browser/weixin.md
Carson dbf1f6afa1 feat(weixin): add Sogou article search (#1250)
- 新增 `clis/weixin/search.js`:通过 Sogou 微信搜索做公众号文章发现,`access: read`
- typed fail-fast: bad query/page/limit upfront ArgumentError;captcha/频控/goto/wait/evaluate/unreadable payload/selector drift/partial card extraction → CommandExecutionError;no-result 页面 → EmptyResultError;--limit 不 silent-clamp >10 直接拒绝
- maintainer-fixes-directly 闭环:rebase 到 latest main `f4637486`、补 access:read、删除 silent-clamp pattern
- F-P-1 first-principles 评估:Sogou 是 public 搜索页 ≠ 微信官方 API,可接受边界 = fail-fast + 清晰字段契约,不做字段猜测/partial success
- CI 全绿(smoke-test SKIPPED);B 组 codex-mini1 lead green + First-principles-1 aux green on `31c2b035`
- 非阻塞残留:search.url 是 Sogou redirect link,串联 download 需后续单独支持 redirect resolution 或暴露 resolved mp URL

Round 15a B 组对位收口。
2026-05-06 00:52:05 +08:00

2.4 KiB

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

# 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 installed
  • create-draft with --cover-image requires Browser Bridge file upload support