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 分