Command Palette

Search for a command to run...

Назад к скиллам
скилл № 90014

zhihu

Search Zhihu & the web, get trending topics, and read/publish on Zhihu (知乎) — search Zhihu content or the entire web via the official Developer Platform API…

БесплатноЗапускает вложенные скрипты
AceDataCloudот AceDataCloud★ 17 звёзд на GitHub

Установить zhihu в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

zhihu — search, read & publish on Zhihu

Two authentication layers, two scripts:

Script Auth Capabilities
scripts/search.py ZHIHU_DEVELOPER_TOKEN (Bearer) Search Zhihu, search the web, get hot topics
scripts/blog.py ZHIHU_COOKIES (login cookie) Read/write own articles & answers

No browser, no third-party deps — just urllib.

The connector injects credentials as env vars:

  • ZHIHU_DEVELOPER_TOKEN — Zhihu Developer Platform access secret (Bearer token). Used for search and hot-list queries. Secret — never echo or print it.
  • ZHIHU_COOKIES — a JSON array of {name, value, domain, path, ...} cookies. Used for reading/writing the user's own content. Secret — never echo or print it.

Locate the scripts first (every Bash block)

The connector sets $SKILL_DIR to this skill's directory, so the scripts live at $SKILL_DIR/scripts/. Do NOT hard-code python3 $SKILL_DIR/scripts/… directly. If more than one skill was loaded in the same turn, $SKILL_DIR can point at the other skill and the call fails with No such file or directory (this is the #1 cause of a Zhihu run silently not finishing). Resolve the path defensively at the top of every Bash block — each Bash call is a fresh shell, so the variable does not carry over:

# blog.py is unique to this skill, so it anchors zhihu's dir even if $SKILL_DIR is wrong.
ZDIR="$SKILL_DIR"; [ -f "$ZDIR/scripts/blog.py" ] || ZDIR=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/blog.py' 2>/dev/null | head -1 | sed 's#/scripts/blog.py##')
[ -f "$ZDIR/scripts/blog.py" ] || { echo "zhihu scripts not found (SKILL_DIR=$SKILL_DIR) — is the skill loaded?" >&2; exit 1; }
SEARCH="$ZDIR/scripts/search.py"; BLOG="$ZDIR/scripts/blog.py"

Then use "$SEARCH" / "$BLOG" (always quoted) as shown below.

Search CLI (search.py)

scripts/search.py — search Zhihu and the web. Requires only ZHIHU_DEVELOPER_TOKEN (no cookies needed).

# Resolve the scripts first (see "Locate the scripts first" above) — robust to $SKILL_DIR.
ZDIR="$SKILL_DIR"; [ -f "$ZDIR/scripts/blog.py" ] || ZDIR=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/blog.py' 2>/dev/null | head -1 | sed 's#/scripts/blog.py##')
SEARCH="$ZDIR/scripts/search.py"

# Search Zhihu content (站内搜索) — questions, answers, articles
python3 "$SEARCH" search "Python 爬虫"
python3 "$SEARCH" search "Python 爬虫" --count 5

# Search the entire web (全网搜索) — all indexed sites
python3 "$SEARCH" global "AI Agent"
python3 "$SEARCH" global "AI Agent" --count 15

# Filter by site or time
python3 "$SEARCH" global "React" --filter 'host=="github.com"'
python3 "$SEARCH" global "新闻" --filter 'publish_time>=1720000000'
python3 "$SEARCH" global "技术" --filter 'host=="github.com" AND publish_time>=1720000000'
python3 "$SEARCH" global "实时新闻" --db realtime

# Get Zhihu trending topics (热榜)
python3 "$SEARCH" hot
python3 "$SEARCH" hot --limit 10

Search commands

Goal Command
Search Zhihu (max 10 results) python3 "$SEARCH" search "<query>" --count N
Search entire web (max 20) python3 "$SEARCH" global "<query>" --count N
Filter by site --filter 'host=="example.com"'
Filter by time --filter 'publish_time>=<unix_ts>'
Search only realtime/static index --db realtime or --db static
Zhihu trending topics (max 30) python3 "$SEARCH" hot --limit N

Search result fields

zhihu_search returns: title, type (Article/Answer), content_id, url, excerpt, vote_up (赞同), comments, author, authority level, edit_time.

global_search returns the same fields plus has_more indicator. The url includes utm tracking params from Zhihu's platform.

hot_list returns: rank, title, url, summary, thumbnail.

global_search Filter syntax

  • host=="example.com" — filter by domain (note: host=="zhihu.com" not supported — use search command instead)
  • publish_time>=1720000000 — filter by publish time (unix seconds)
  • Logical operators: AND, OR (must be uppercase)
  • Parentheses for grouping: (host=="a.com" OR host=="b.com") AND publish_time>=T

Blog CLI (blog.py)

The skill ships scripts/blog.py — self-contained, stdlib only. Requires ZHIHU_COOKIES (login cookie).

# Resolve the scripts first (see "Locate the scripts first" above) — robust to $SKILL_DIR.
ZDIR="$SKILL_DIR"; [ -f "$ZDIR/scripts/blog.py" ] || ZDIR=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/blog.py' 2>/dev/null | head -1 | sed 's#/scripts/blog.py##')
BLOG="$ZDIR/scripts/blog.py"

# Read (run directly)
python3 "$BLOG" whoami                     # who is logged in
python3 "$BLOG" articles --limit 20        # my published articles + stats
python3 "$BLOG" article <article-id>       # one article's details + stats
python3 "$BLOG" answers --limit 20         # my published answers + stats
python3 "$BLOG" answer <answer-id>         # one answer's details + stats
python3 "$BLOG"
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • scripts/blog.py
  • scripts/search.py

FAQ

Что делает скилл zhihu?

Search Zhihu & the web, get trending topics, and read/publish on Zhihu (知乎) — search Zhihu content or the entire web via the official Developer Platform API, get hot topics (热榜), list published articles & answers with stats, inspect content, publish articles, and answer questions. Use when the user mentions 知乎 / Zhihu, 搜索知乎, 全网搜索, 热榜, "我的知乎文章/回答", reading stats, 发文, or 回答问题.

Как установить скилл zhihu?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл zhihu запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить zhihu с