Skip to content

feat(weixin): add --stdout flag to download command#1770

Open
Daily-AC wants to merge 2 commits into
jackwener:mainfrom
Daily-AC:main
Open

feat(weixin): add --stdout flag to download command#1770
Daily-AC wants to merge 2 commits into
jackwener:mainfrom
Daily-AC:main

Conversation

@Daily-AC
Copy link
Copy Markdown

@Daily-AC Daily-AC commented May 27, 2026

Summary

Adds --stdout flag to opencli weixin download, mirroring the same flag already on opencli web read. Threads through the existing ArticleDownloadOptions.stdout?: boolean option in src/download/article-download.ts (which web/read already uses).

Motivation

Brings weixin/download to streaming parity with web/read, which already exposes --stdout via the same ArticleDownloadOptions.stdout option in src/download/article-download.ts. Downstream pipelines (agent search tools, content indexers, RAG ingestion) can then pipe weixin articles identically to any web article.

(Concrete consumer triggering this: omnireach, a multi-source agent search tool — its omnireach fetch <wechat-url> was returning verification-page garbage from generic web fetchers; this gives it the missing cookie-strategy path.)

Implementation

~4 functional lines in clis/weixin/download.js:

  • Add { name: 'stdout', type: 'boolean', default: false, ... } to args
  • Pass stdout: kwargs.stdout through to downloadArticle() options
  • return kwargs.stdout ? null : result; to suppress Commander row output in streaming mode (mirrors clis/web/read.js exactly)

The errorHint early-return path is unchanged; --stdout does not affect verification-gate handling — detectWechatAccessIssue short-circuits before downloadArticle() is called, so the structured verification-required row is still returned regardless of --stdout.

Tests

New clis/weixin/download.test.js with 7 tests covering --stdout=true / false × happy path / errorHint × command registration. All 4671 existing tests still pass (1 pre-existing skip unrelated).

Related

Related to #1759 (douyin/search). Both expose existing infrastructure to module CLI surface — douyin adds a new module, this exposes existing --stdout semantics from ArticleDownloadOptions already used by web/read. Independent reviews, no merge-order dependency.

张以琳 added 2 commits May 26, 2026 22:53
DOM extraction from www.douyin.com/search/<q>?type=video. Requires logged-in
profile. plays/comments/shares exposed as 0 (card markup only surfaces likes);
see Follow-ups for full-counter path. Schema aligned with tiktok search.

Refs Daily-AC/omnireach#12
Mirrors the --stdout pattern already used by clis/web/read.js, which
threads through the existing `stdout?: boolean` option in
ArticleDownloadOptions (src/download/article-download.ts). When --stdout
is set, the markdown body is written to process.stdout via the existing
downloadArticle() helper, image downloads are skipped (downloadArticle
handles this), and the CLI func returns null to suppress Commander's row
output that would otherwise corrupt the piped stream.

The errorHint early-return path is unchanged — verification gate
detection runs before downloadArticle() is called, so --stdout has zero
effect on that branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant