This repository has been archived on 2026-08-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
kb-skills/kb-zhihu-metadata/SKILL.md
T
starmen1265 85797d0a89 feat: kb-zhihu-metadata 支持 ZHIHU_COOKIE
- 安装 markdownify 依赖
- PlaywrightBrowser 支持传入 Cookie
- ZhihuPlaywrightExtractor 支持传入 Cookie
- zhihu_metadata.py 读取 ZHIHU_COOKIE 环境变量
- 更新 SKILL.md 添加 Cookie 配置说明
2026-02-27 15:39:19 +08:00

63 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# KB Zhihu Metadata Skill
**kb-zhihu-metadata** - Extract Zhihu question/answer/user metadata.
## Features
- Question metadata extraction
- Answer metadata extraction
- User information extraction
- JSON output format
- Markdown conversion support
- **Cookie 支持**:可配置 ZHIHU_COOKIE 访问需要登录的内容
## 环境变量
| 变量名 | 用途 | 必需 |
|--------|------|------|
| `ZHIHU_COOKIE` | 知乎登录 Cookie | 推荐(访问专栏等需要) |
**获取 ZHIHU_COOKIE**:
1. 登录知乎网页版
2. 打开开发者工具 (F12) → Application → Cookies → zhihu.com
3. 复制 Cookie 字符串
```bash
# 添加到 ~/.kb_env
echo 'export ZHIHU_COOKIE="你的知乎Cookie"' >> ~/.kb_env
source ~/.kb_env
```
## Commands
```bash
# Question metadata
python zhihu_metadata.py --id "266309957" --type question
# Answer metadata
python zhihu_metadata.py --id "2003427891925509507" --type answer
```
## Output
```json
{
"success": true,
"data": {
"platform": "zhihu",
"type": "question",
"id": "266309957",
"title": "问题标题",
"author": "作者名字",
"answer_count": 50,
"followers": 1000
}
}
```
## Installation
```bash
cp -r kb-zhihu-metadata/ ~/skills/
```