What does zhihu-automation-skill do?
Zhihu automation tool — post articles/ideas/Q&A/interactions/data extraction, dual-channel architecture (HTTP read + browser write).
This skill provides Zhihu automation capabilities using a dual-channel approach:
- HTTP channel: Fast read operations (timelines, articles, search, data extraction).
- Browser channel: Comprehensive write operations (posting articles, ideas, replies, interactions).
Features
- Post articles, ideas, and answers to Zhihu.
- Interact: follow, like, collect, and comment.
- Extract structured data from Zhihu pages using HTTP requests.
- Dual-channel architecture ensures reliability and performance.
- Supports both single and batch operations.
Tool Interfaces
1. publish_article
- Publishes a new article on Zhihu.
- Input: title, content
- Output: article URL, status
2. publish_idea
- Publishes a new idea (short post) on Zhihu.
- Input: content, image URL (optional)
- Output: idea URL, status
3. reply_question
- Posts an answer to a Zhihu question.
- Input: question ID, content
- Output: answer URL, status
4. follow_user
- Follows a specified Zhihu user.
- Input: user ID
- Output: follow status
5. like_content
- Likes a specified Zhihu content item (article/answer/idea).
- Input: content ID, content type
- Output: like status
6. collect_content
- Collects a specified Zhihu content item into a collection.
- Input: content ID, collection ID
- Output: collect status
7. comment_on_content
- Comments on a specified Zhihu content item.
- Input: content ID, content type, comment text
- Output: comment status
8. extract_zhihu_data
- Extracts structured data from a Zhihu page (e.g., article content, timeline, search results).
- Input: URL or query, optional filters
- Output: JSON data
9. batch_interact
- Performs batch interactions (e.g., follow multiple users, like multiple items).
- Input: list of interaction tasks
- Output: batch status
Requirements
- Internet connection.
- Zhihu account login (for browser-based operations).
- Dependencies: requests, beautifulsoup4, playwright (or similar browser automation library).
Usage Notes
- The HTTP channel is preferred for read operations due to speed.
- The browser channel is required for write operations that need user authentication.
- Ensure your environment has a compatible browser (Chromium recommended) for browser automation.
- Respect Zhihu's rate limits and terms of service.
Configuration
- Set environment variables for credentials (optional, required for authenticated operations).
ZHIHU_COOKIES: Cookies for HTTP channel authentication.ZHIHU_BROWSER_SESSION: Browser session configuration.
Example (Conceptual)
# Publish an article
publish_article(
title="How to automate Zhihu with AI",
content="This is a sample article body..."
)
# Extract data from a Zhihu page
data = extract_zhihu_data(
url="https://www.zhihu.com/question/123456789"
)
License
MIT