Zhiwho is a local-first command-line client for Zhihu. It provides a terminal UI for browsing the follow feed, reading questions and articles, managing personal content, and publishing Markdown back to Zhihu from an authenticated browser session.
The project is designed for users who prefer keyboard-driven workflows and want their Zhihu session, cookies, and cache to stay on their own machine.
- Keyboard-driven TUI for the Zhihu follow feed.
- Top refresh: newly discovered feed items are inserted at the top instead of replacing older content.
- Local cache for faster startup and offline-friendly feed/profile previews.
- Personal data view with categories for dynamics, answers, articles, questions, pins, and videos.
- Richer terminal rendering for headings, quotes, lists, links, and code-like content.
- Question, answer, article, pin, and video detection from Zhihu URLs.
- Read Zhihu questions/articles from the CLI.
- Publish Markdown articles and answers through a logged-in browser session.
- Manage Zhihu collections from the command line.
- Optional AI-agent command entrypoint for higher-level workflows.
Zhiwho is early-stage software. It automates parts of Zhihu's web experience through Playwright, so UI selectors and behavior may need updates when Zhihu changes its site.
The project stores authentication cookies and cache files under ~/.zhiwho by default.
- Node.js 20 or newer.
- npm.
- A Zhihu account for authenticated features.
- Playwright Chromium.
Clone the repository and install dependencies:
git clone git@github.com:ChenMiaoi/zhiwho.git
cd zhiwho
npm ci
npx playwright install chromiumBuild the project:
npm run buildRun from source during development:
npm run devRun the built CLI:
npm start -- --helpInteractive login opens a browser so you can sign in to Zhihu:
npm run dev -- loginImport cookies from a JSON file:
npm run dev -- login --import cookies.jsonRun login in headless mode:
npm run dev -- login --headlessOpen the TUI:
npm run devOr explicitly open the feed:
npm run dev -- feedCommon TUI shortcuts:
| Key | Action |
|---|---|
↑ / ↓ |
Move selection |
PgUp / PgDn |
Move by page |
Enter |
Open selected item |
Space |
Load more feed items |
r |
Refresh from the top |
m |
Open personal data |
Esc |
Go back |
q |
Quit |
Read a question or article:
npm run dev -- read "https://www.zhihu.com/question/123456"
npm run dev -- read "https://zhuanlan.zhihu.com/p/123456"Publish a Markdown article:
npm run dev -- publish article.md
npm run dev -- publish article.md --collection "My Collection"Answer a question from Markdown:
npm run dev -- answer "https://www.zhihu.com/question/123456" -f answer.mdManage collections:
npm run dev -- collection list
npm run dev -- collection create "New Collection"Configuration:
npm run dev -- config show
npm run dev -- config get headless
npm run dev -- config set headless trueAI-agent entrypoint:
npm run dev -- agent "搜索 Rust 相关的高赞回答"
npm run dev -- agent --interactiveZhiwho writes local runtime files to ~/.zhiwho:
| File | Purpose |
|---|---|
cookies.json |
Browser cookies used for authenticated Zhihu requests |
cache-db.json |
TUI feed/profile cache |
config.json |
CLI configuration |
Do not commit these files. They may contain private account data.
Install dependencies:
npm ciRun type checking:
npm run typecheckBuild:
npm run buildRun the default test target:
npm testRun the TUI locally:
npm run devProject layout:
src/
cli/ Commander command definitions
core/ Browser, auth, cache, formatting, and Zhihu operations
tui/ Terminal feed and profile UI
GitHub Actions runs on pushes and pull requests. The workflow installs dependencies with npm ci, type-checks the project, builds TypeScript, and verifies the built CLI can print help.
Releases are tag-driven. Pushing a semver tag such as v0.1.0 starts the release workflow.
The release workflow:
- Verifies that the tag matches
package.jsonversion. - Installs dependencies with
npm ci. - Runs type checking and build.
- Runs a built CLI smoke test.
- Publishes the package to npm with provenance through npm Trusted Publishing/OIDC.
- Creates a GitHub Release with generated notes.
Create a release:
npm version patch
git push origin main
git push origin v0.1.1For prereleases, use a prerelease version such as v0.2.0-beta.1; npm will publish it with the next dist-tag.
The first npm version must be published manually before npm Trusted Publishing can be enabled for this package. After enabling Trusted Publishing on npm, the GitHub release workflow does not require an NPM_TOKEN secret.
- Zhiwho is not affiliated with Zhihu.
- Treat cookies as secrets.
- Prefer a dedicated browser session or imported cookie file when testing.
- Review generated content before publishing or answering.
- Respect Zhihu's terms and rate limits.
Issues and pull requests are welcome. For substantial changes, open an issue first so the behavior and scope can be discussed.
Before opening a pull request, run:
npm test
npm run buildZhiwho is released under the MIT License.