Zhihu

io.github.KrisTHL181由 GitHub 账号 KrisTHL181 发布v0.3.0更新于 Oct 29, 2026

Zhihu CLI for AI agents: search, read, download, and publish from the terminal.

概览

AI 生成的概览

非官方知乎命令行工具封装成的 MCP 服务器,让助手在终端中搜索、阅读、下载、发布和分析知乎内容。

可以做什么
  • 搜索并浏览知乎的问题、文章、用户、话题、推荐流、热榜和知乎日报
  • 将文章、回答、问题、想法和视频下载为 Markdown 文件
  • 发布和修改用 Markdown 撰写的回答与文章
  • 进行社交互动:点赞、感谢、关注、屏蔽、评论、管理收藏夹、收发私信
  • 将创作与动态导出为 JSON,并提供创作者收益分析与词频、词云、聚类等 NLP 工具
适用场景
适合希望助手无需浏览器即可处理知乎内容的场景:检索话题资料、把帖子归档为 Markdown、起草并发布回答,或分析自己的创作者数据和已下载的内容库。
运行要求
以 Python 包(zhihu-mcp,属于 zhihu-toolkit)通过 stdio 在本机运行,需要 Python 3.10 或更高版本。需要知乎账号会话,可通过粘贴浏览器开发者工具中的 cURL、扫码登录或导入本地浏览器会话获得。NLP、创作者分析、LLM 和浏览器导入等功能需安装可选依赖。
安装前请注意
这是非官方客户端,与知乎官方无关,使用风险自负。它会按配置保存知乎 Cookie 和 User-Agent 请求头,并对请求签名以规避检测,应将这些凭据视为敏感信息。发布、编辑、评论、点赞、关注和私信都会改动账号数据。下载与分析会在本地目录写入文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Zhihu,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

🧢 zhihu-cli

The terminal is your new Zhihu HQ.

A feature-complete, automation-ready Zhihu CLI & Developer Toolkit.

browse · download · search · publish · analyze — all from the command line.

[Python 3.10+] [License: MIT] [GitHub Repo stars]


zhihu-cli turns your terminal into a full-featured Zhihu client. Authenticate once, then browse, search, download, publish, and analyze — without ever opening a browser.

⚠️ This is an unofficial CLI for Zhihu. Use at your own risk. Not affiliated with Zhihu Inc.

👉 Looking for the DSH plugin? → dsh-plugin/


🚀 Quick Start

Requirement: Python 3.10 or newer. Check your version with python --version before installing.

bash
# Installpip install zhihu-toolkit

1. Authenticate

bash
zhihu auth paste          # paste a cURL from browser DevToolszhihu auth login          # scan a QR code with the Zhihu Appzhihu auth import         # import the session from a local browser (needs: pip install 'zhihu-toolkit[browser]')

2. Verify

bash
zhihu auth status         # check login status and active profile

✨ What You Can Do

📖 Read & Browse

Browse Zhihu's feeds, hot lists, questions, articles, pins, and comments — all rendered in your terminal with a Rich-powered pager. Explore the real-time trending list with excerpts, scroll through your personalized recommend feed, or dive into a question and its full answer thread without clicking a single link. Zhihu Daily (知乎日报) has its own group: zhihu daily latest, zhihu daily before <date>, and zhihu daily story <id> --save.

💾 Download for Offline

Save any Zhihu content (articles, answers, questions, pins, videos) as clean Markdown with YAML frontmatter. Download individual pieces or batch-process from a manifest. Everything lands in ~/.zhihu-cli/downloads/, organized by type, ready for your note-taking system or offline reading.

🔍 Search

Search questions, articles, users, and topics across Zhihu. Fine-tune result depth and quantity — all from the command line.

✍️ Publish & Edit

Write answers and articles in Markdown, publish them to Zhihu with one command. Need to update? Modify existing answers and articles from your local files. Markdown-to-HTML conversion happens automatically via Zhihu's own rendering pipeline.

💬 Interact

Vote, thank, follow, block, and comment — full social interaction without the browser. Manage collections: create, populate, and organize them. Send and receive direct messages, and stream real-time notifications and chat via MQTT.

🕸️ Scrape & Export

Batch-export your creations, activity history, answers, and articles as structured JSON. Use the universal converter to merge and normalize across formats for your own data pipeline.

📊 Analyze

Creator analytics — pull your Zhihu income data and visualize it: monthly summaries, trend charts (with EMA), advanced indicators (Bollinger Bands, MACD), derivative analysis (velocity/acceleration/jerk), weekday breakdowns, and per-content daily metrics. Charts are saved as PNGs.

NLP tools — run word frequency analysis, generate word clouds, and perform K-means clustering on your downloaded content. All operate across your full Markdown library.

🔐 Multi-Account

Save multiple profiles from different accounts, switch between them with a single command. Each profile keeps its own auth credentials and cookies.


🏗️ Architecture

src/zhihu_cli/├── main.py                  # Click CLI — command group hub├── output.py                # styled terminal output (Rich)├── content/│   ├── handlers/            # one file per Zhihu domain│   └── utils/               # HTML↔Markdown, ZSE v4 signing├── creator_tools/           # income analytics + plotting├── nlp_tools/               # word count, wordcloud, clustering└── extensions/              # plugin system (auto-discovered)
LayerWhat It Does
🔐 AuthBrowser Cookie + User-Agent headers from cURL paste or QR code login, cached per-profile
✍️ SigningEvery Zhihu request gets auto-signed with x-zse-93 / x-zse-96 headers via ZSE v4 cipher
🌐 Requestscurl_cffi impersonates Chrome's TLS fingerprint to avoid detection
📄 ExtractionPrefers direct API calls; falls back to HTML page scraping with js-initialData parsing
📝 MarkdownHTML → LaTeX preprocessing → recursive traversal → clean Markdown. Reverse for publishing
🔌 ExtensionsDrop a plugin in extensions/ with register_cli(group) — auto-discovered at startup

🧪 Extras

Optional Dependencies

bash
pip install "zhihu-toolkit[nlp]"          # jieba, matplotlib, wordcloud, scikit-learn...pip install "zhihu-toolkit[creator]"      # matplotlib, numpy, pandas, seaborn...pip install "zhihu-toolkit[classifier]"   # torch, transformers, scikit-learn...pip install "zhihu-toolkit[llm]"          # openai (zhihu agora ai, zhihu chat bot, crank)pip install "zhihu-toolkit[notify]"       # desktop-notifier (zhihu chat interactive --notify)pip install "zhihu-toolkit[browser]"      # browser-cookie3 (zhihu auth import)pip install "zhihu-toolkit[mcp]"          # click2mcp (the zhihu-mcp server entry point)

Shell Completions

Click ships completion for each shell — add the matching line to your rc file:

bash
# basheval "$(_ZHIHU_COMPLETE=bash_source zhihu)"# zsheval "$(_ZHIHU_COMPLETE=zsh_source zhihu)"# fish_ZHIHU_COMPLETE=fish_source zhihu | source

From a repository clone, python autocomp.py detects your shell and prints the right line.


🤝 Contributing

PRs welcome! The codebase is structured for extensibility:

  • New command? Add a file to commands/ with a register_<name>(group) function, import it in main.py.
  • New handler? Add a file to content/handlers/ — follow the existing patterns.
  • New extension? Create extensions/<name>/ with an __init__.py exposing register_cli(group).

Run the formatter before submitting:

bash
pre-commit run --all-filesruff check .ruff format .

📜 License

MIT


Made with ❤️ and way too many terminal sessions.

Report a bug · Fork this repository · Star ⭐ this repo!

来源:README.md,提交 d57cc08

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.3.0最新Oct 29, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分