tikhub-api-helper

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TikHub 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:
  1. Search for relevant APIs using the searcher script
  2. Show the user available options with parameters
  3. Call the API with appropriate parameters
  4. Return formatted results to the user
当用户询问TikHub API或需要获取社交媒体数据时:
  1. 使用搜索脚本搜索相关API
  2. 向用户展示包含参数的可用选项
  3. 使用合适的参数调用API
  4. 向用户返回格式化后的结果

Available Scripts

可用脚本

API Searcher -
api_searcher.py

API搜索工具 -
api_searcher.py

Search and find relevant TikHub API endpoints.
bash
undefined
搜索并查找相关的TikHub API接口。
bash
undefined

Search 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
undefined
python api_searcher.py detail:tiktok_web_fetch_user_profile_get
undefined

API Client -
api_client.py

API客户端 -
api_client.py

Make HTTP requests to TikHub API endpoints.
bash
undefined
向TikHub API接口发送HTTP请求。
bash
undefined

Health 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://..."}'
undefined
python api_client.py POST /api/v1/tiktok/web/generate_xgnarly '{"url": "https://..."}'
undefined

Supported Platforms

支持的平台

PlatformTag NameAPIs Available
TikTok Web
TikTok-Web-API
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.
平台标签名称可用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
查看所有分类。

Common Use Cases

常见使用场景

Get User Profile

获取用户资料

bash
undefined
bash
undefined

TikTok 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"
undefined
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"
undefined

Get Video Details

获取视频详情

bash
undefined
bash
undefined

TikTok 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"
undefined
python api_searcher.py "fetch post detail" python api_client.py GET /api/v1/tiktok/web/fetch_post_detail "post_id=POST_ID"
undefined

Search Content

搜索内容

bash
undefined
bash
undefined

Search for videos/users

搜索视频/用户

python api_searcher.py "search video" python api_client.py GET /api/v1/tiktok/web/fetch_search_video "keyword=YOUR_KEYWORD"
undefined
python api_searcher.py "search video" python api_client.py GET /api/v1/tiktok/web/fetch_search_video "keyword=YOUR_KEYWORD"
undefined

Get Comments

获取评论

bash
undefined
bash
undefined

Get video comments

获取视频评论

python api_searcher.py "fetch comment" python api_client.py GET /api/v1/tiktok/web/fetch_post_comment "post_id=POST_ID"
undefined
python api_searcher.py "fetch comment" python api_client.py GET /api/v1/tiktok/web/fetch_post_comment "post_id=POST_ID"
undefined

Authentication

认证方式

API requests use a default token for development. For production use, users should:
  1. Get their API token from TikHub User
  2. Set the
    TIKHUB_TOKEN
    environment variable
  3. Or modify
    DEFAULT_TOKEN
    in
    api_client.py
Request format:
json
{
  "Authorization": "Bearer YOUR_API_TOKEN"
}
API请求在开发环境使用默认令牌。生产环境使用时,用户需要:
  1. TikHub用户中心 获取API令牌
  2. 设置
    TIKHUB_TOKEN
    环境变量
  3. 或者修改
    api_client.py
    中的
    DEFAULT_TOKEN
请求格式:
json
{
  "Authorization": "Bearer YOUR_API_TOKEN"
}

Base URLs

基础URL

  • China users:
    https://api.tikhub.dev
    (bypasses GFW)
  • International:
    https://api.tikhub.io
The API client auto-detects the appropriate URL. To override, modify the
use_china_domain
parameter in the client.
  • 中国用户
    https://api.tikhub.dev
    (可绕过GFW)
  • 国际用户
    https://api.tikhub.io
API客户端会自动检测合适的URL。如需手动指定,可修改客户端中的
use_china_domain
参数。

Rate 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:
  1. Understand the user's goal - What data do they want? From which platform?
  2. Search for relevant APIs - Use
    api_searcher.py
    with appropriate keywords
  3. Present options - Show matching APIs with brief descriptions
  4. Guide parameters - Check what parameters are required using
    detail:OPERATION_ID
  5. Make the request - Use
    api_client.py
    with the user's parameters
  6. Format results - Present the API response in a clear, readable format
当帮助用户使用TikHub API时:
  1. 理解用户目标 - 他们需要什么数据?来自哪个平台?
  2. 搜索相关API - 使用
    api_searcher.py
    和合适的关键词
  3. 展示选项 - 显示匹配的API及简要说明
  4. 指导参数设置 - 使用
    detail:OPERATION_ID
    查看所需参数
  5. 发起请求 - 使用
    api_client.py
    和用户提供的参数
  6. 格式化结果 - 以清晰易读的格式返回API响应

Example Workflow

示例流程

User: "I want to get a TikTok user's profile"
bash
undefined
用户:"我想获取TikTok用户的资料"
bash
undefined

Step 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:格式化并展示结果

undefined
undefined

Error Handling

错误处理

Common errors and solutions:
ErrorSolution
401 Unauthorized
Check API token is valid
429 Too Many Requests
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
常见错误及解决方案:
错误解决方案
401 Unauthorized
检查API令牌是否有效
429 Too Many Requests
超出速率限制,等待后重试
Connection error
检查网络,若在中国大陆可尝试使用中国区域名
Missing parameter
查看API详情确认所需参数

Reference

参考链接