feat(weixin): add --stdout flag to download command#1770
Open
Daily-AC wants to merge 2 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--stdoutflag toopencli weixin download, mirroring the same flag already onopencli web read. Threads through the existingArticleDownloadOptions.stdout?: booleanoption insrc/download/article-download.ts(whichweb/readalready uses).Motivation
Brings
weixin/downloadto streaming parity withweb/read, which already exposes--stdoutvia the sameArticleDownloadOptions.stdoutoption insrc/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:{ name: 'stdout', type: 'boolean', default: false, ... }to argsstdout: kwargs.stdoutthrough todownloadArticle()optionsreturn kwargs.stdout ? null : result;to suppress Commander row output in streaming mode (mirrorsclis/web/read.jsexactly)The errorHint early-return path is unchanged;
--stdoutdoes not affect verification-gate handling —detectWechatAccessIssueshort-circuits beforedownloadArticle()is called, so the structured verification-required row is still returned regardless of--stdout.Tests
New
clis/weixin/download.test.jswith 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
--stdoutsemantics fromArticleDownloadOptionsalready used byweb/read. Independent reviews, no merge-order dependency.