证据快照复核于 2026-09-16GitHub 数据核对日期: 2026-08-21
证据已验证Plugin Bundle集成与连接Web Profile

Zhihu for DeepSeek Harness

通过 DeepSeek Harness 工具和轻量网页面板使用本地已登录的知乎 CLI。

快速了解

它能做什么

通过 DeepSeek Harness 工具和轻量网页面板使用本地已登录的知乎 CLI。

本站提供的是中文说明,不代表该项目或 Plugin 自身提供中文界面;语言支持请以上游文档为准。

使用场景
集成与连接集成搜索自动化
适配技术
deepseek-harnesszhihupyzhihu-cli
兼容性

Web Profile
>=0.1.5-rc.1

可信度与状态

证据已验证
核对日期 2026/9/13 UTC 14:18

有代码证据的贡献

它为 DSH 增加什么

知乎智能体工具

提供 zhihu_* 工具,用于已登录的搜索、热榜、问题、回答、用户、推荐流、话题、收藏和通知;写入工具需显式启用。

机制证据
知乎网页面板

添加悬浮知乎入口和设置页卡片,用于登录、配置、热榜查看和搜索。

机制证据

选择前先看

该 DSH Bundle 将本地安装的 pyzhihu-cli 封装为 zhihu_* 智能体工具,可搜索知乎、查看热榜、阅读问题和回答,以及查看用户、推荐流、话题、收藏和通知。网页面板提供二维码登录、配置、热榜快捷查看和搜索。随附 Bundle 默认启用只读模式,因此在你明确关闭只读前,写入工具不会被注册。

适合谁

已使用知乎、希望在 DeepSeek Harness 中通过本地 CLI 和浏览器面板访问知乎的用户。

常见任务

  • 登录后搜索知乎内容或查看当前热榜。
  • 读取问题、回答、评论、用户资料、推荐流、话题、收藏或通知。
  • 通过二维码或粘贴 Cookie 登录,并设置 CLI 路径、代理、超时和只读模式。
  • 仅在确实需要时启用发布、投票、关注或删除操作。

权限与数据

运行本地知乎 CLI,使用你的已认证知乎会话,并为网页面板提供仅限回环地址的 Web API。

权限
  • 执行本地 zhihu 命令。
  • 读取和写入 ~/.dsh/dsh-zhihu.json 下的插件配置。
  • 使用本地 CLI 目录及其 Cookie 文件完成知乎认证。
  • 只有显式将 readOnly 设为 false 后,才会注册写入操作。
数据处理
  • 文档说明插件配置文件权限为 0600。
  • 知乎凭据不保存在插件配置中;Cookie 由 CLI 保存于 <cliHome>/cookies.json。
  • Cookie 登录会直接写入 CLI 文件,避免令牌出现在进程列表中。
  • 网页面板以 PNG data URL 返回二维码,并说明接口仅限回环访问。
外部服务
  • 通过 pyzhihu-cli 访问知乎 API。
凭据
  • 包括热榜在内的每个 pyzhihu-cli 命令都需要已登录的知乎会话。

局限

  • 需要另行安装 pyzhihu-cli,并使其位于 PATH 中或配置绝对 cliPath。
  • 知乎风控可能拒绝请求或二维码轮询;README 建议此时导入本地 Chrome 会话。
  • 评论、带评论的推荐流和话题热榜等部分功能会从 JSON 回退为文本结果。
  • 知乎 API 行为和 CLI 命令能力可能变化。
  • 提供的证据未实际执行安装或运行。

DSHub 已核对

  • 固定提交的源代码声明了 DSH Bundle patch、web 客户端平台、Node 要求和 DSH 引擎要求。
  • 清单和 Bundle patch 已通过提供的结构检查。
  • 固定 patch 将插件配置为启用且默认只读。
  • 已验证 npm 上 0.1.1 版本的注册表身份,但未审计其包内容。

DSHub 未核对

  • 未证明在 DSH profile 中安装成功。
  • 除仓库声明外,未独立测试兼容性。
  • 提供的记录未证明运行行为、登录成功或外部 API 可用性。

固定版本安装

安装 Zhihu for DeepSeek Harness

这个Plugin Bundle没有 DSH Plugin 安装操作,请根据源码文档使用真实交付方式。

访问源码项目

维护者原文

项目 README

查看 commit 0c13948 对应的 README
维护者编写的上游内容原文于 2026/9/13README.md 获取,正文和仓库相对媒体固定到 commit 0c1394888b9b,内容哈希为 21594fff35e8。以下是未经 DSHub 翻译的上游原文,语言可能与当前页面不同;第三方托管的 badge 可能独立更新。

@zhengjunyao/dsh-zhihu

A Zhihu (知乎) plugin for DeepSeek Harness: it wraps the local zhihu CLIpyzhihu-cli, command name zhihu — as zhihu_* agent tools. Search questions, read the hot list, inspect questions / answers / comments, look up users, browse the recommended feed, topics and notifications. Publishing, voting, following and deleting are off by default and gated behind an explicit readOnly switch.

  • Read tools call zhihu <command> --json and normalize the raw Zhihu API payload into compact items (id, type, title, URL, author, upvotes, answer count).
  • Login rides Zhihu's official QR-code API: the CLI writes the QR image to a PNG and the plugin hands the path to the agent, which can show it to the user. Pasting a cookie string is also supported — the plugin writes the CLI's cookie file directly, so the token never lands in the process list.
  • Write tools are not registered at all by default, so nothing can be published or deleted by accident.

Prerequisites

# Install the Zhihu CLI (Python 3.10+; uv keeps it in its own venv)
uv tool install pyzhihu-cli      # or: pipx install pyzhihu-cli
zhihu --version                  # zhihu-cli, version 0.2.4

The plugin resolves zhihu from $PATH, ~/.local/bin, /opt/homebrew/bin and /usr/local/bin; point cliPath at an absolute path if it lives elsewhere.

Important: every pyzhihu-cli command requires a login — even the hot list fails with Not authenticated. The first run must therefore be a zhihu_login.

Tools

Management and auth

Tool Purpose
zhihu_status CLI availability and version, login state (cookie has z_c0/_xsrf/d_c0), read-only mode, paths, timeout. Never echoes cookie contents
zhihu_config Configure readOnly / cliPath / timeoutMs / loginWaitMs / proxy / cliHome; reset: true restores defaults. Call with no arguments to read
zhihu_login Log in. mode: qrcode (default) returns the QR PNG path (~/.zhihu-cli/login_qrcode.png) to show the user and can be called again to keep waiting (it never spawns a second QR code); mode: cookie accepts pasted z_c0/_xsrf/d_c0 and verifies online
zhihu_logout Remove the CLI's cookie file
zhihu_whoami Current account profile

Read

Tool Purpose
zhihu_search Search content (type: general|people|topic)
zhihu_hot Zhihu hot list
zhihu_question Question detail; answers: true adds the answer list (limit / sort)
zhihu_answer Answer body; comments: true adds comments
zhihu_user User profile, or their answers / articles / followers / following (include)
zhihu_feed Recommended feed; withComments: true uses the CLI's text-mode "feed + comments"
zhihu_topic Topic detail; hotQuestions: true adds the topic's hot questions
zhihu_notifications Notifications (with offset paging)
zhihu_collections Your collections

Write (registered only when readOnly: false)

Tool Purpose
zhihu_publish Publish a question / pin / article (kind: ask|pin|article, optional topics and local images; dryRun: true only echoes the command)
zhihu_vote Upvote / cancel an upvote
zhihu_follow_question Follow / unfollow a question
zhihu_delete Delete your own question / pin / article (requires explicit confirm: true)

Web panel

Two entries, one component:

  1. A bottom-right floating ball (blue 「知」 button) — reachable from any page, opening a 380px popover.
  2. A 「知乎」 card in the settings page (settings.section).

The panel covers: login state with an inline QR code (one click, auto-detects the scan), the account summary, the read-only switch, proxy / timeout settings, and quick hot-list / search lookups with clickable links.

It talks to the loopback-only /api/dsh-zhihu/* route family (status, config, login, qrcode, logout, whoami, hot, search); non-loopback peers, foreign Host headers and cross-site Origins get 403. The QR is returned as a PNG data URL — no new files on disk.

Client changes need a browser hard refresh; host changes or dsh.client manifest changes need a dsh web restart.

Read-only switch

The plugin is read-only by default: write tools are never registered, so the model cannot even see them.

Two ways to open them up:

// 1) At install time, seed it in cordis.patch.yml
- insert:
    - id: zhihu
      name: dsh-zhihu
      config:
        readOnly: false
2) At runtime via the tool (stored in ~/.dsh/dsh-zhihu.json, remounts immediately):
   zhihu_config({ readOnly: false })     # enable write tools
   zhihu_config({ readOnly: true })      # revoke them

The store value wins over the install-time seed; with neither set, read-only applies.

Configuration

Key Default Meaning
readOnly true Only read tools when true; write tools are registered when false
cliPath zhihu CLI command name or absolute path
timeoutMs 90000 Per-invocation timeout
loginWaitMs 15000 How long zhihu_login waits for a scan before returning; call it again to keep waiting
proxy empty Empty = inherit the environment; none = force no proxy (Zhihu is a domestic site, a system proxy can actually break it); or http://host:port
cliHome ~/.zhihu-cli CLI config directory. The CLI hardcodes Path.home()/".zhihu-cli", so the plugin overrides the child process's HOME

Stored in ~/.dsh/dsh-zhihu.json (mode 0600). Credentials are not stored here — the CLI keeps cookies in <cliHome>/cookies.json (the CLI chmods it 0600 itself).

Logging in

Option 1 — QR code (recommended)

zhihu_login()                     → returns qrcodePath (~/.zhihu-cli/login_qrcode.png)
   ↓ the agent shows it with read_image / present
the user scans it in the Zhihu app
zhihu_login()                     → keeps waiting; returns authenticated: true

Option 2 — paste a cookie

zhihu_login({ mode: "cookie", cookie: "z_c0=...; _xsrf=...; d_c0=..." })

The plugin writes the cookie straight into the CLI's cookies.json (byte-compatible with the CLI's own save_cookies) and then verifies it online via zhihu whoami; a failed check removes the file and reports why. Unlike zhihu login --cookie, this path never exposes the token in the process list.

Compatibility

Requires DeepSeek Harness ≥ 0.1.5-rc.1 (declared in dsh.engines.dsh, which the plugin market reads) and is tested on 0.1.5-rc.1. This build follows the DSH 0.1.5 strict tool-result contract (lossless-JSON snapshots, additionalProperties: false schema validation, output.render returning ContentBlock[]) and resolves the executable independently of the host PATH (a launchd-managed host only has /usr/bin:/bin).

Known limitations

  • The CLI's --json mode does not cover comments, the "feed + comments" command, or a topic's hot questions. Those three fall back to text mode and land in the result's text field (ANSI colour codes stripped).
  • zhihu_search / zhihu_hot accept -a/--answers only in the CLI's human-readable mode; it is ignored under --json, so the plugin does not expose it.
  • Zhihu applies risk control. This plugin is a thin wrapper — request volume and compliance are the caller's responsibility; do not crawl aggressively.
  • Zhihu's public API can change; the real command surface is whatever zhihu <cmd> --help reports locally.

Troubleshooting

Symptom Cause and fix
Every command fails with Not authenticated pyzhihu-cli needs a session for all commands, the hot list included. Run zhihu_login first.
403 with code 40352, a redirect to /account/unhuman, or "系统监测到您的网络环境存在异常" Zhihu risk control rejects the request fingerprint, not just missing cookies — so re-pasting a cookie may not help. Use zhihu_login({ mode: "browser" }) to import the real session from local Chrome, then retry. QR-code polling is anonymous and gets 403 on every poll, which is why scanning appears to do nothing.
403 with code 10003 mentioning x-zse-96 The endpoint requires Zhihu's request signature. Topic detail is unavailable; zhihu_question automatically falls back to the answer list (the embedded question.title carries the title).
zhihu_status reports the CLI unavailable Install it (uv tool install pyzhihu-cli) or point cliPath at an absolute path.
The panel's QR code never completes the login Expected under risk control, for the reason above. Use the 「从 Chrome 导入登录态」 button in the panel instead.

Every failure now names which of these it is: failureReason classifies the CLI output instead of returning a bare timeout.

Development

pnpm install
pnpm typecheck         # tsc --noEmit (host + client)
pnpm build             # tsc for .d.ts + tsdown for lib/index.js (host) and lib/client.js (browser)
pnpm test              # smoke tests (real CLI calls; all writes land in a temp dir)
pnpm test:e2e          # drive the plugin's own tools against the real CLI (no host restart)
node tests/routes.mjs  # hit /api/dsh-zhihu/* with synthetic req/res
node tests/client.mjs  # execute lib/client.js under a synthetic __ModuleLoader__
pnpm verify:full       # portability check in an isolated DSH_HOME (tarball install + stability watch)

Portability verification follows PORTABILITY-SOP.md and must print ✅ 通过 before a release.

Artifacts: lib/index.js (host, ESM) + lib/client.js (browser closure-factory) + lib/types/ (.d.ts).

Install into a profile

dsh plugin --profile web add @zhengjunyao/dsh-zhihu
dsh plugin --profile web add link:/path/to/dsh-zhihu
# or, once published
dsh plugin --profile web add github:zhengjy01/dsh-zhihu

A DSH web restart is required afterwards (there is no hot reload).

License

MIT. The Zhihu CLI itself (pyzhihu-cli) is Apache-2.0; this project only invokes it as a subprocess and contains none of its code.

有意识地管理

安装与管理

前置条件与目标 Profile

目标 Web Profile

交付方式 Git Bundle — zhengjy01/dsh-zhihu#0c1394888b9bb1b38c11d7b119ef28e68ddaa625

验证、更新与移除

显示生命周期命令
验证
dsh plugin --profile web list

兼容性与访问范围

Requires DeepSeek Harness 0.1.5-rc.1 or newer >=0.1.5-rc.1

检查兼容性证据

风险事实

account-authentication

Requires an authenticated Zhihu session

证据
write-capability

Publishing, voting, following, and deletion can be enabled by turning off read-only mode

证据
local-credential-storage

Zhihu cookies are stored locally by the CLI

证据
证据与编辑审查Manifest、Bundle patch、分发与新鲜度

不可变证据

审查状态与源码活动

AI 已审查

MIT 许可的 DSH 知乎集成,使用已认证的知乎会话。除非有明确写入需求,否则应保持只读模式。

AI 审查于 2026/9/13 UTC 14:19GitHub 事实核对日期: 2026/9/13 UTC 14:19

自当前证据基线以来,没有记录到重要源码变化。

下一步

按 Plugin 安装流程操作

订阅重要变化: Zhihu for DeepSeek Harness