搜索

PythonReactSEOPDF
OpenClaw

zhihu-cli

Install, use, develop, debug, test, and extend the zhihu-cli (pyzhihu-cli) project. Use when: installing pyzhihu-cli, running zhihu CLI commands, logging in to Zhihu, searching/browsing content, adding new CLI commands, fixing bugs, writing tests, modifying display output, updating auth flow, or understanding the project architecture.

baiguangmei0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install baiguangmei/pyzhihu-cli

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

zhihu-cli Skill

What is zhihu-cli

zhihu-cli(PyPI 包名 pyzhihu-cli)是一个 Python 命令行工具,在终端中浏览知乎内容。支持搜索、热榜、问题、回答、用户、投票、关注、发布提问、发布想法、发布文章等 23 个子命令。

  • PyPI 包名: pyzhihu-cli
  • CLI 命令名: zhihu
  • Python 要求: >= 3.10

Installation(安装)

用户安装(从 PyPI)
# 推荐方式:使用 uv(全局命令行工具)
uv tool install pyzhihu-cli

# 或使用 pipx
pipx install pyzhihu-cli

# 或使用 pip
pip install pyzhihu-cli
开发安装(从源码)
# 克隆仓库
git clone https://github.com/BAIGUANGMEI/zhihu-cli.git
cd zhihu-cli

# 创建虚拟环境并安装
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
# source .venv/bin/activate

pip install -e .

二维码登录通过知乎 API(POST /api/v3/account/api/login/qrcode)获取 token 与 link,在终端用 qrcode 库渲染二维码,轮询 scan_info 直至扫码确认,无需 Playwright。


Usage(使用方法)

1. 登录(首次使用必须先登录)
# 方式一:二维码扫码登录(推荐,仅需 requests + qrcode,无需 Playwright)
zhihu login --qrcode

# 方式二:手动提供 Cookie 字符串(至少包含 z_c0)
zhihu login --cookie "z_c0=xxx; _xsrf=yyy; d_c0=zzz"

Cookie 获取方法:在浏览器登录知乎 → F12 → Network → 任意请求 → Headers → Cookie,复制完整值。

信息获取类命令说明:建议使用--json输出原始JSON数据,获得更加详细的数据。

2. 验证登录状态
# 离线检查(只查本地 cookie 文件)
zhihu status

# 在线验证并显示个人资料
zhihu whoami

# JSON 格式输出
zhihu whoami --json
3. 搜索
zhihu search "Python 学习"
zhihu search "机器学习" --type topic
zhihu search "张三" --type people
zhihu search "Python" --limit 20
zhihu search "Python" --json
4. 热榜
zhihu hot
zhihu hot --limit 10
zhihu hot --json
5. 问题与回答
# 查看问题详情
zhihu question 12345678

# 查看问题下的回答
z...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/baiguangmei/pyzhihu-cli
Version
—
Commit
f6e0ed459ab31fdad9de82889efcbe56e132f875
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# zhihu-cli Skill

## What is zhihu-cli

zhihu-cli(PyPI 包名 `pyzhihu-cli`)是一个 Python 命令行工具,在终端中浏览知乎内容。支持搜索、热榜、问题、回答、用户、投票、关注、发布提问、发布想法、发布文章等 23 个子命令。

- **PyPI 包名**: `pyzhihu-cli`
- **CLI 命令名**: `zhihu`
- **Python 要求**: >= 3.10

---

## Installation(安装)

### 用户安装(从 PyPI)

```bash
# 推荐方式:使用 uv(全局命令行工具)
uv tool install pyzhihu-cli

# 或使用 pipx
pipx install pyzhihu-cli

# 或使用 pip
pip install pyzhihu-cli
```

### 开发安装(从源码)

```bash
# 克隆仓库
git clone https://github.com/BAIGUANGMEI/zhihu-cli.git
cd zhihu-cli

# 创建虚拟环境并安装
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
# source .venv/bin/activate

pip install -e .
```

二维码登录通过知乎 API(`POST /api/v3/account/api/login/qrcode`)获取 token 与 link,在终端用 `qrcode` 库渲染二维码,轮询 `scan_info` 直至扫码确认,**无需 Playwright**。

---

## Usage(使用方法)

### 1. 登录(首次使用必须先登录)

```bash
# 方式一:二维码扫码登录(推荐,仅需 requests + qrcode,无需 Playwright)
zhihu login --qrcode

# 方式二:手动提供 Cookie 字符串(至少包含 z_c0)
zhihu login --cookie "z_c0=xxx; _xsrf=yyy; d_c0=zzz"
```

Cookie 获取方法:在浏览器登录知乎 → F12 → Network → 任意请求 → Headers → Cookie,复制完整值。


## ***信息获取类命令说明:建议使用--json输出原始JSON数据,获得更加详细的数据。***

### 2. 验证登录状态

```bash
# 离线检查(只查本地 cookie 文件)
zhihu status

# 在线验证并显示个人资料
zhihu whoami

# JSON 格式输出
zhihu whoami --json
```

### 3. 搜索

```bash
zhihu search "Python 学习"
zhihu search "机器学习" --type topic
zhihu search "张三" --type people
zhihu search "Python" --limit 20
zhihu search "Python" --json
```

### 4. 热榜

```bash
zhihu hot
zhihu hot --limit 10
zhihu hot --json
```

### 5. 问题与回答

```bash
# 查看问题详情
zhihu question 12345678

# 查看问题下的回答
z...

相关技能

OpenClaw

bambu-studio-ai

heyixuan2

Bambu Lab 3D printer control and automation. Activate when user mentions: printer status, 3D printing, slice, analyze model, generate 3D, AMS filament, print monitor, Bambu Lab, or any 3D printing task. Full pi...

OpenClaw

geo-optimization

capt-marbles

Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discove...

OpenClaw

0protocol

0isone

Agents can sign plugins, rotate credentials without losing identity, and publicly attest to behavior.

OpenClaw

0x0-messenger

eijiac24

Send and receive P2P messages using disposable numbers and PINs. No servers, no accounts. Use for human notifications, approval flows, and agent-to-agent communication.