feat: add kuaishou skill for short-video platform operations
This commit is contained in:
212
social-media/kuaishou/SKILL.md
Normal file
212
social-media/kuaishou/SKILL.md
Normal file
@@ -0,0 +1,212 @@
|
||||
---
|
||||
name: kuaishou
|
||||
description: Interact with Kuaishou (快手) — China's second-largest short-video platform. Use the Kuaishou Open Platform API for video publishing, data analytics, livestream management, and user engagement. Primarily for China-market social media operations.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
platforms: [linux, macos]
|
||||
prerequisites:
|
||||
env_vars: [KUAISHOU_APP_ID, KUAISHOU_APP_SECRET, KUAISHOU_ACCESS_TOKEN, KUAISHOU_REFRESH_TOKEN]
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [kuaishou, 快手, short-video, china, social-media, livestream]
|
||||
homepage: https://open.kuaishou.com
|
||||
---
|
||||
|
||||
# Kuaishou (快手)
|
||||
|
||||
Interact with Kuaishou (快手), China's second-largest short-video and livestreaming platform (after Douyin/抖音). Useful for China-market social media operations, influencer management, and cross-platform content distribution.
|
||||
|
||||
## Overview
|
||||
|
||||
Kuaishou has over 700 million monthly active users, with a strong user base in lower-tier Chinese cities. It supports:
|
||||
- Short video upload and management
|
||||
- Livestreaming (带货/电商 livestream sales)
|
||||
- Data analytics and insights
|
||||
- User engagement (comments, likes, follows)
|
||||
- Kuaishou Store (小店) e-commerce integration
|
||||
|
||||
## Kuaishou Open Platform
|
||||
|
||||
Kuaishou provides an official Open Platform at https://open.kuaishou.com with REST APIs and SDKs.
|
||||
|
||||
### Developer Portal
|
||||
|
||||
- https://open.kuaishou.com — Main developer portal
|
||||
- https://open.kuaishou.com/platform — API documentation
|
||||
- https://open.kuaishou.com/product — Product offerings (self-service, enterprise)
|
||||
|
||||
### API Categories
|
||||
|
||||
| Category | Description |
|
||||
|----------|-------------|
|
||||
| Video (视频) | Upload, delete, list, get video info |
|
||||
| Livestream (直播) | Start/end stream, get stream status, manage comments |
|
||||
| User (用户) | Get user info, followers, following |
|
||||
| Data (数据) | Analytics, playback metrics, fan growth |
|
||||
| Commerce (电商) | Kuaishou Store orders, products, settlement |
|
||||
|
||||
## Credentials
|
||||
|
||||
You need four values from the Kuaishou Open Platform:
|
||||
|
||||
- `KUAISHOU_APP_ID` — Your application ID
|
||||
- `KUAISHOU_APP_SECRET` — Your application secret
|
||||
- `KUAISHOU_ACCESS_TOKEN` — OAuth access token (short-lived)
|
||||
- `KUAISHOU_REFRESH_TOKEN` — OAuth refresh token (long-lived, for renewing access token)
|
||||
|
||||
### Getting Credentials
|
||||
|
||||
1. Register at https://open.kuaishou.com
|
||||
2. Create an application in the developer console
|
||||
3. Choose the required permissions (scopes)
|
||||
4. Obtain `app_id` and `app_secret`
|
||||
5. Complete OAuth flow to get `access_token` and `refresh_token`
|
||||
|
||||
### Token Renewal
|
||||
|
||||
Access tokens expire after ~24 hours. Refresh before expiry:
|
||||
|
||||
```bash
|
||||
curl -X POST "https://open.kuaishou.com/oauth2/refresh_token" \
|
||||
-d "app_id=${KUAISHOU_APP_ID}&app_secret=${KUAISHOU_APP_SECRET}&refresh_token=${KUAISHOU_REFRESH_TOKEN}"
|
||||
```
|
||||
|
||||
### Where to Store Credentials
|
||||
|
||||
Store in `~/.hermes/.env` or a dedicated `~/.config/kuaishou/.env`:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/kuaishou
|
||||
cat > ~/.config/kuaishou/.env <<'EOF'
|
||||
KUAISHOU_APP_ID=your_app_id
|
||||
KUAISHOU_APP_SECRET=your_app_secret
|
||||
KUAISHOU_ACCESS_TOKEN=your_access_token
|
||||
KUAISHOU_REFRESH_TOKEN=your_refresh_token
|
||||
EOF
|
||||
chmod 600 ~/.config/kuaishou/.env
|
||||
```
|
||||
|
||||
## Common API Calls
|
||||
|
||||
### Authentication
|
||||
|
||||
```bash
|
||||
# Get access token (OAuth)
|
||||
curl -X POST "https://open.kuaishou.com/oauth2/access_token" \
|
||||
-d "app_id=${KUAISHOU_APP_ID}&app_secret=${KUAISHOU_APP_SECRET}&code=AUTH_CODE&grant_type=authorization_code"
|
||||
|
||||
# Refresh access token
|
||||
curl -X POST "https://open.kuaishou.com/oauth2/refresh_token" \
|
||||
-d "app_id=${KUAISHOU_APP_ID}&app_secret=${KUAISHOU_APP_SECRET}&refresh_token=${KUAISHOU_REFRESH_TOKEN}"
|
||||
```
|
||||
|
||||
### User Info
|
||||
|
||||
```bash
|
||||
# Get current user info
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/user/info"
|
||||
|
||||
# Get user by ID
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/user?user_id=USER_ID"
|
||||
```
|
||||
|
||||
### Video Management
|
||||
|
||||
```bash
|
||||
# List own videos
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/video/list"
|
||||
|
||||
# Get video details
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/video?video_id=VIDEO_ID"
|
||||
|
||||
# Upload video (multipart)
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
-F "file=@video.mp4" \
|
||||
-F "title=Video Title" \
|
||||
-F "description=Video description" \
|
||||
"https://open.kuaishou.com/api/openplatform/video/upload"
|
||||
|
||||
# Delete video
|
||||
curl -X POST -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
-d "video_id=VIDEO_ID" \
|
||||
"https://open.kuaishou.com/api/openplatform/video/delete"
|
||||
```
|
||||
|
||||
### Video Data / Analytics
|
||||
|
||||
```bash
|
||||
# Get video analytics
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/data/video?video_id=VIDEO_ID"
|
||||
|
||||
# Get video playback data
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/data/video/play?video_id=VIDEO_ID"
|
||||
```
|
||||
|
||||
### Livestream
|
||||
|
||||
```bash
|
||||
# Get livestream status
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/livestream/status"
|
||||
|
||||
# Get livestream analytics
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/livestream/data"
|
||||
```
|
||||
|
||||
### Comments
|
||||
|
||||
```bash
|
||||
# List comments on a video
|
||||
curl -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
"https://open.kuaishou.com/api/openplatform/comment/list?video_id=VIDEO_ID"
|
||||
|
||||
# Reply to a comment
|
||||
curl -X POST -H "Authorization: Bearer ${KUAISHOU_ACCESS_TOKEN}" \
|
||||
-d "video_id=VIDEO_ID&comment_id=COMMENT_ID&content=REPLY_TEXT" \
|
||||
"https://open.kuaishou.com/api/openplatform/comment/reply"
|
||||
```
|
||||
|
||||
## Agent Workflow
|
||||
|
||||
1. Confirm credentials are set in environment
|
||||
2. Verify token is still valid (try a read-only call like `/user/info`)
|
||||
3. If 401/403, refresh the access token first
|
||||
4. Perform read operations before write operations
|
||||
5. For uploads, confirm file format and size limits before proceeding
|
||||
|
||||
## Video Requirements
|
||||
|
||||
Kuaishou video requirements:
|
||||
- Format: MP4 (H.264/AVC video, AAC audio)
|
||||
- Duration: 5 seconds to 10 minutes (for regular uploads)
|
||||
- Resolution: Recommended 720p or above
|
||||
- File size: Up to ~2GB for most accounts (higher for verified enterprise accounts)
|
||||
- Cover image: Recommended 720x1280 or similar 9:16 ratio
|
||||
|
||||
## API Rate Limits
|
||||
|
||||
| Tier | Rate Limit |
|
||||
|------|------------|
|
||||
| Basic (self-service) | 1000 requests/day |
|
||||
| Enterprise | Higher limits available |
|
||||
|
||||
Check response headers for rate limit status:
|
||||
- `X-RateLimit-Remaining`
|
||||
- `X-RateLimit-Reset`
|
||||
|
||||
## Notes
|
||||
|
||||
- Kuaishou API documentation is primarily in Chinese. Use machine translation if needed.
|
||||
- Enterprise permissions (企业认证) unlock more API capabilities and higher rate limits.
|
||||
- The Kuaishou Open Platform uses JSON for request/response.
|
||||
- All API calls must include `Authorization: Bearer {access_token}` header.
|
||||
- Some APIs require specific scopes — check your app's permission settings in the developer console.
|
||||
- Livestream APIs are separate from video APIs and often require additional permissions.
|
||||
Reference in New Issue
Block a user