tikhub-api-helper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTikHub API Helper
TikHub API 助手
A skill to help users search, find, and call TikHub API endpoints for social media data.
一个帮助用户搜索、查找并调用TikHub API接口以获取社交媒体数据的工具。
Quick Start
快速开始
When a user asks about TikHub API or wants to fetch social media data:
- Search for relevant APIs using the searcher script
- Show the user available options with parameters
- Call the API with appropriate parameters
- Return formatted results to the user
当用户询问TikHub API或需要获取社交媒体数据时:
- 使用搜索脚本搜索相关API
- 向用户展示包含参数的可用选项
- 使用合适的参数调用API
- 向用户返回格式化后的结果
Available Scripts
可用脚本
API Searcher - api_searcher.py
api_searcher.pyAPI搜索工具 - api_searcher.py
api_searcher.pySearch and find relevant TikHub API endpoints.
bash
undefined搜索并查找相关的TikHub API接口。
bash
undefinedSearch by keyword
按关键词搜索
python api_searcher.py "user profile"
python api_searcher.py "视频评论"
python api_searcher.py "trending"
python api_searcher.py "user profile"
python api_searcher.py "视频评论"
python api_searcher.py "trending"
List all APIs for a specific tag/category
列出特定标签/分类下的所有API
python api_searcher.py tag:TikTok-Web-API
python api_searcher.py tag:Douyin-App-V3-API
python api_searcher.py tag:TikTok-Web-API
python api_searcher.py tag:Douyin-App-V3-API
List popular/common APIs
列出热门/常用API
python api_searcher.py popular
python api_searcher.py popular
List all available tags/categories
列出所有可用标签/分类
python api_searcher.py tags
python api_searcher.py tags
Get detailed info for a specific API
获取特定API的详细信息
python api_searcher.py detail:tiktok_web_fetch_user_profile_get
undefinedpython api_searcher.py detail:tiktok_web_fetch_user_profile_get
undefinedAPI Client - api_client.py
api_client.pyAPI客户端 - api_client.py
api_client.pyMake HTTP requests to TikHub API endpoints.
bash
undefined向TikHub API接口发送HTTP请求。
bash
undefinedHealth check (no authentication required)
健康检查(无需认证)
python api_client.py GET /api/v1/health/check
python api_client.py GET /api/v1/health/check
Get user profile
获取用户资料
python api_client.py GET /api/v1/tiktok/web/fetch_user_profile "sec_user_id=MS4wLjABAAAA..."
python api_client.py GET /api/v1/tiktok/web/fetch_user_profile "sec_user_id=MS4wLjABAAAA..."
Search for videos
搜索视频
python api_client.py GET /api/v1/tiktok/web/fetch_search_video "keyword=gaming"
python api_client.py GET /api/v1/tiktok/web/fetch_search_video "keyword=gaming"
POST request with JSON body
带JSON请求体的POST请求
python api_client.py POST /api/v1/tiktok/web/generate_xgnarly '{"url": "https://..."}'
undefinedpython api_client.py POST /api/v1/tiktok/web/generate_xgnarly '{"url": "https://..."}'
undefinedSupported Platforms
支持的平台
| Platform | Tag Name | APIs Available |
|---|---|---|
| TikTok Web | | 58 endpoints |
| TikTok App | | 76 endpoints |
| Douyin Web | | 76 endpoints |
| Douyin App | | 45 endpoints |
| Douyin Search | | 20 endpoints |
| Douyin Billboard | | 31 endpoints |
| Xiaohongshu Web | | 26 endpoints |
| 26 endpoints | |
| YouTube | | 16 endpoints |
| 13 endpoints | |
| 23 endpoints | |
| Bilibili | | 24 endpoints |
| 33 endpoints | |
| Zhihu | | 32 endpoints |
Use to see all categories.
python api_searcher.py tags| 平台 | 标签名称 | 可用API数量 |
|---|---|---|
| TikTok Web | | 58个接口 |
| TikTok App | | 76个接口 |
| 抖音 Web | | 76个接口 |
| 抖音 App | | 45个接口 |
| 抖音搜索 | | 20个接口 |
| 抖音榜单 | | 31个接口 |
| 小红书 Web | | 26个接口 |
| 26个接口 | |
| YouTube | | 16个接口 |
| 13个接口 | |
| 23个接口 | |
| Bilibili | | 24个接口 |
| 微博 | | 33个接口 |
| 知乎 | | 32个接口 |
使用 查看所有分类。
python api_searcher.py tagsCommon Use Cases
常见使用场景
Get User Profile
获取用户资料
bash
undefinedbash
undefinedTikTok user profile
TikTok用户资料
python api_searcher.py "fetch user profile tiktok"
python api_client.py GET /api/v1/tiktok/web/fetch_user_profile "sec_user_id=USER_ID"
undefinedpython api_searcher.py "fetch user profile tiktok"
python api_client.py GET /api/v1/tiktok/web/fetch_user_profile "sec_user_id=USER_ID"
undefinedGet Video Details
获取视频详情
bash
undefinedbash
undefinedTikTok video details
TikTok视频详情
python api_searcher.py "fetch post detail"
python api_client.py GET /api/v1/tiktok/web/fetch_post_detail "post_id=POST_ID"
undefinedpython api_searcher.py "fetch post detail"
python api_client.py GET /api/v1/tiktok/web/fetch_post_detail "post_id=POST_ID"
undefinedSearch Content
搜索内容
bash
undefinedbash
undefinedSearch for videos/users
搜索视频/用户
python api_searcher.py "search video"
python api_client.py GET /api/v1/tiktok/web/fetch_search_video "keyword=YOUR_KEYWORD"
undefinedpython api_searcher.py "search video"
python api_client.py GET /api/v1/tiktok/web/fetch_search_video "keyword=YOUR_KEYWORD"
undefinedGet Comments
获取评论
bash
undefinedbash
undefinedGet video comments
获取视频评论
python api_searcher.py "fetch comment"
python api_client.py GET /api/v1/tiktok/web/fetch_post_comment "post_id=POST_ID"
undefinedpython api_searcher.py "fetch comment"
python api_client.py GET /api/v1/tiktok/web/fetch_post_comment "post_id=POST_ID"
undefinedAuthentication
认证方式
API requests use a default token for development. For production use, users should:
- Get their API token from TikHub User
- Set the environment variable
TIKHUB_TOKEN - Or modify in
DEFAULT_TOKENapi_client.py
Request format:
json
{
"Authorization": "Bearer YOUR_API_TOKEN"
}API请求在开发环境使用默认令牌。生产环境使用时,用户需要:
- 从 TikHub用户中心 获取API令牌
- 设置 环境变量
TIKHUB_TOKEN - 或者修改 中的
api_client.pyDEFAULT_TOKEN
请求格式:
json
{
"Authorization": "Bearer YOUR_API_TOKEN"
}Base URLs
基础URL
- China users: (bypasses GFW)
https://api.tikhub.dev - International:
https://api.tikhub.io
The API client auto-detects the appropriate URL. To override, modify the parameter in the client.
use_china_domain- 中国用户:(可绕过GFW)
https://api.tikhub.dev - 国际用户:
https://api.tikhub.io
API客户端会自动检测合适的URL。如需手动指定,可修改客户端中的 参数。
use_china_domainRate Limits
速率限制
- QPS: 10 requests per second per endpoint
- Timeout: 30-60 seconds
- Retry: Max 3 retries on error
- QPS:每个接口每秒最多10次请求
- 超时时间:30-60秒
- 重试机制:错误时最多重试3次
Instructions for Claude
给Claude的使用说明
When helping users with TikHub API:
- Understand the user's goal - What data do they want? From which platform?
- Search for relevant APIs - Use with appropriate keywords
api_searcher.py - Present options - Show matching APIs with brief descriptions
- Guide parameters - Check what parameters are required using
detail:OPERATION_ID - Make the request - Use with the user's parameters
api_client.py - Format results - Present the API response in a clear, readable format
当帮助用户使用TikHub API时:
- 理解用户目标 - 他们需要什么数据?来自哪个平台?
- 搜索相关API - 使用 和合适的关键词
api_searcher.py - 展示选项 - 显示匹配的API及简要说明
- 指导参数设置 - 使用 查看所需参数
detail:OPERATION_ID - 发起请求 - 使用 和用户提供的参数
api_client.py - 格式化结果 - 以清晰易读的格式返回API响应
Example Workflow
示例流程
User: "I want to get a TikTok user's profile"
bash
undefined用户:"我想获取TikTok用户的资料"
bash
undefinedStep 1: Search for the relevant API
步骤1:搜索相关API
python api_searcher.py "tiktok user profile"
python api_searcher.py "tiktok user profile"
Step 2: Show results and confirm endpoint
步骤2:展示结果并确认接口
Found: GET /api/v1/tiktok/web/fetch_user_profile
找到:GET /api/v1/tiktok/web/fetch_user_profile
Step 3: Get detailed parameter info
步骤3:获取详细参数信息
python api_searcher.py detail:tiktok_web_fetch_user_profile_get
python api_searcher.py detail:tiktok_web_fetch_user_profile_get
Step 4: Make the API call with user's parameters
步骤4:使用用户提供的参数调用API
python api_client.py GET /api/v1/tiktok/web/fetch_user_profile "sec_user_id=MS4wLjABAAAA..."
python api_client.py GET /api/v1/tiktok/web/fetch_user_profile "sec_user_id=MS4wLjABAAAA..."
Step 5: Format and present results
步骤5:格式化并展示结果
undefinedundefinedError Handling
错误处理
Common errors and solutions:
| Error | Solution |
|---|---|
| Check API token is valid |
| Rate limit exceeded, wait before retry |
| Check network, try China domain if in mainland China |
| Check API details for required parameters |
常见错误及解决方案:
| 错误 | 解决方案 |
|---|---|
| 检查API令牌是否有效 |
| 超出速率限制,等待后重试 |
| 检查网络,若在中国大陆可尝试使用中国区域名 |
| 查看API详情确认所需参数 |
Reference
参考链接
- Full API Documentation: TikHub API Docs
- Apifox Docs: docs.tikhub.io
- API Status: monitor.tikhub.io
- GitHub: github.com/TikHub
- 完整API文档:TikHub API Docs
- Apifox文档:docs.tikhub.io
- API状态监控:monitor.tikhub.io
- GitHub仓库:github.com/TikHub