TikHub API Helper
A skill to help users search, find, and call TikHub API endpoints for social media data.
Quick Start
When a user asks about TikHub API or wants to fetch social media data:
- 1. 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
Available Scripts
API Searcher - api_searcher.py
Search and find relevant TikHub API endpoints.
CODEBLOCK0
API Client - api_client.py
Make HTTP requests to TikHub API endpoints.
CODEBLOCK1
Supported Platforms
| Platform | Tag Name | APIs Available |
|---|
| TikTok Web | INLINECODE2 | 58 endpoints |
| TikTok App |
TikTok-App-V3-API | 76 endpoints |
| Douyin Web |
Douyin-Web-API | 76 endpoints |
| Douyin App |
Douyin-App-V3-API | 45 endpoints |
| Douyin Search |
Douyin-Search-API | 20 endpoints |
| Douyin Billboard |
Douyin-Billboard-API | 31 endpoints |
| Xiaohongshu Web |
Xiaohongshu-Web-API | 26 endpoints |
| Instagram |
Instagram-V2-API | 26 endpoints |
| YouTube |
YouTube-Web-API | 16 endpoints |
| Twitter |
Twitter-Web-API | 13 endpoints |
| Reddit |
Reddit-APP-API | 23 endpoints |
| Bilibili |
Bilibili-Web-API | 24 endpoints |
| Weibo |
Weibo-Web-V2-API | 33 endpoints |
| Zhihu |
Zhihu-Web-API | 32 endpoints |
Use python api_searcher.py tags to see all categories.
Common Use Cases
Get User Profile
CODEBLOCK2
Get Video Details
CODEBLOCK3
Search Content
CODEBLOCK4
Get Comments
CODEBLOCK5
Authentication
API requests use a default token for development. For production use, users should:
- 1. Get their API token from TikHub User
- Set the
TIKHUB_TOKEN environment variable - Or modify
DEFAULT_TOKEN in INLINECODE19
Request format:
CODEBLOCK6
Base URLs
- - China users:
https://api.tikhub.dev (bypasses GFW) - International: INLINECODE21
The API client auto-detects the appropriate URL. To override, modify the use_china_domain parameter in the client.
Rate Limits
- - QPS: 10 requests per second per endpoint
- Timeout: 30-60 seconds
- Retry: Max 3 retries on error
Instructions for Claude
When helping users with TikHub API:
- 1. Understand the user's goal - What data do they want? From which platform?
- Search for relevant APIs - Use
api_searcher.py with appropriate keywords - Present options - Show matching APIs with brief descriptions
- Guide parameters - Check what parameters are required using INLINECODE24
- Make the request - Use
api_client.py with the user's parameters - Format results - Present the API response in a clear, readable format
Example Workflow
User: "I want to get a TikTok user's profile"
CODEBLOCK7
Error Handling
Common errors and solutions:
| Error | Solution |
|---|
| INLINECODE26 | Check API token is valid |
| INLINECODE27 |
Rate limit exceeded, wait before retry |
|
Connection error | Check network, try China domain if in mainland China |
|
Missing parameter | Check API details for required parameters |
Reference
技能名称: tikhub-api-helper
详细描述:
TikHub API 助手
一个帮助用户搜索、查找和调用 TikHub API 端点以获取社交媒体数据的技能。
快速开始
当用户询问关于 TikHub API 或想要获取社交媒体数据时:
- 1. 使用搜索脚本搜索相关 API
- 向用户展示可用选项及其参数
- 使用适当参数调用 API
- 向用户返回格式化结果
可用脚本
API 搜索器 - api_searcher.py
搜索并查找相关的 TikHub API 端点。
bash
按关键词搜索
python api_searcher.py 用户资料
python api_searcher.py 视频评论
python api_searcher.py 热门趋势
列出特定标签/分类下的所有 API
python api_searcher.py tag:TikTok-Web-API
python api_searcher.py tag:Douyin-App-V3-API
列出热门/常用 API
python api_searcher.py popular
列出所有可用标签/分类
python api_searcher.py tags
获取特定 API 的详细信息
python api
searcher.py detail:tiktokweb
fetchuser
profileget
API 客户端 - api_client.py
向 TikHub API 端点发送 HTTP 请求。
bash
健康检查(无需认证)
python api_client.py GET /api/v1/health/check
获取用户资料
python api
client.py GET /api/v1/tiktok/web/fetchuser
profile secuser_id=MS4wLjABAAAA...
搜索视频
python api
client.py GET /api/v1/tiktok/web/fetchsearch_video keyword=gaming
发送带 JSON 体的 POST 请求
python api
client.py POST /api/v1/tiktok/web/generatexgnarly {url: https://...}
支持的平台
| 平台 | 标签名称 | 可用 API 数量 |
|---|
| TikTok Web | TikTok-Web-API | 58 个端点 |
| TikTok App |
TikTok-App-V3-API | 76 个端点 |
| 抖音 Web | Douyin-Web-API | 76 个端点 |
| 抖音 App | Douyin-App-V3-API | 45 个端点 |
| 抖音搜索 | Douyin-Search-API | 20 个端点 |
| 抖音榜单 | Douyin-Billboard-API | 31 个端点 |
| 小红书 Web | Xiaohongshu-Web-API | 26 个端点 |
| Instagram | Instagram-V2-API | 26 个端点 |
| YouTube | YouTube-Web-API | 16 个端点 |
| Twitter | Twitter-Web-API | 13 个端点 |
| Reddit | Reddit-APP-API | 23 个端点 |
| Bilibili | Bilibili-Web-API | 24 个端点 |
| 微博 | Weibo-Web-V2-API | 33 个端点 |
| 知乎 | Zhihu-Web-API | 32 个端点 |
使用 python api_searcher.py tags 查看所有分类。
常见用例
获取用户资料
bash
TikTok 用户资料
python api_searcher.py 获取用户资料 tiktok
python api
client.py GET /api/v1/tiktok/web/fetchuser
profile secuser
id=USERID
获取视频详情
bash
TikTok 视频详情
python api_searcher.py 获取帖子详情
python api
client.py GET /api/v1/tiktok/web/fetchpost
detail postid=POST_ID
搜索内容
bash
搜索视频/用户
python api_searcher.py 搜索视频
python api
client.py GET /api/v1/tiktok/web/fetchsearch
video keyword=YOURKEYWORD
获取评论
bash
获取视频评论
python api_searcher.py 获取评论
python api
client.py GET /api/v1/tiktok/web/fetchpost
comment postid=POST_ID
认证
API 请求在开发阶段使用默认令牌。生产环境下,用户应:
- 1. 从 TikHub 用户中心 获取自己的 API 令牌
- 设置 TIKHUBTOKEN 环境变量
- 或修改 apiclient.py 中的 DEFAULTTOKEN
请求格式:
json
{
Authorization: Bearer YOURAPITOKEN
}
基础 URL
- - 中国用户:https://api.tikhub.dev(绕过防火墙)
- 国际用户:https://api.tikhub.io
API 客户端会自动检测合适的 URL。如需覆盖,请修改客户端中的 usechinadomain 参数。
速率限制
- - QPS:每个端点每秒 10 次请求
- 超时:30-60 秒
- 重试:出错时最多重试 3 次
给 Claude 的指令
在帮助用户使用 TikHub API 时:
- 1. 理解用户的目标 - 他们想要什么数据?来自哪个平台?
- 搜索相关 API - 使用 apisearcher.py 配合适当关键词
- 展示选项 - 显示匹配的 API 及其简要描述
- 指导参数 - 使用 detail:OPERATIONID 检查所需参数
- 发起请求 - 使用 api_client.py 配合用户提供的参数
- 格式化结果 - 以清晰可读的格式呈现 API 响应
示例工作流程
用户:我想获取一个 TikTok 用户的资料
bash
步骤 1:搜索相关 API
python api_searcher.py tiktok 用户资料
步骤 2:展示结果并确认端点
找到:GET /api/v1/tiktok/web/fetchuserprofile
步骤 3:获取详细参数信息
python api
searcher.py detail:tiktokweb
fetchuser
profileget
步骤 4:使用用户参数调用 API
python api
client.py GET /api/v1/tiktok/web/fetchuser
profile secuser_id=MS4wLjABAAAA...
步骤 5:格式化并展示结果
错误处理
常见错误及解决方案:
| 错误 | 解决方案 |
|---|
| 401 Unauthorized | 检查 API 令牌是否有效 |
| 429 Too Many Requests |
超出速率限制,等待后重试 |
| Connection error | 检查网络,若在中国大陆可尝试使用中国域名 |
| Missing parameter | 检查 API 详情中的必需参数 |
参考