关于 tiktok-scraper
tiktok-scraper 是面向数据分析与社交媒体研究的 TikTok 数据 API 技能,可检索帖子、账号、评论及标签、音乐和地点信息。
主要功能
- 01按关键词搜索并筛选帖子
- 02按用户名查询账号资料
- 03获取帖子、关注者和关注列表
- 04读取评论及回复
- 05检索标签、音乐和地点帖子
适用场景
- 01按热度或日期发现帖子
- 02跟踪账号发布内容与关注者
- 03分析帖子评论和回复
- 04监测标签、音乐或地点相关内容
MCP 相关
提供位于 https://tiktok.fetcher.sh/mcp 的 MCP 服务,支持端点检索、端点说明、余额查询及付费数据获取。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ fetcher-sh/ fetcher-skills --skill tiktok-scraper安装后在 Claude Code 中输入/tiktok-scraper确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/comparison.mdendpoints.mdfaq.mdscenarios.md详细介绍
TikTok Scraper API
按需获取 TikTok 数据:支持按关键词搜索帖子并筛选排序方式和日期、按账号名查询个人资料、获取关注者和关注列表、查看话题标签及音乐/声音动态、按位置查找帖子,以及查看评论串——每次调用只需发送一条普通 HTTP GET 请求,按调用付费。无需登录、会话 Cookie、浏览器自动化或 TikTok 开发者应用审核。
基础 URL:https://tiktok.fetcher.sh
快速参考
| 基础 URL | https://tiktok.fetcher.sh |
| 身份验证 | Authorization: Bearer bby_live_... 或 x402(USDC) |
| 价格 | 每次调用 $0.004(固定) |
| 端点 | 13 个,全部为 GET |
| MCP | https://tiktok.fetcher.sh/mcp |
| 机器可读文件 | /openapi.json · /llms.txt · /skill.md |
我需要哪个端点?
| 我想要…… | 调用 |
|---|---|
| 按关键词搜索帖子(可选按最受欢迎/最新排序) | GET /api/post/search |
| 按分享 URL 查询帖子 | GET /api/post?url=... |
| 按 @用户名查询个人资料 | GET /api/user/handle/{username} |
| 获取用户的帖子、关注者或关注列表 | GET /api/user/{id}/posts / /followers / /followings |
| 获取帖子的评论 | GET /api/post/{id}/comments |
| 查找带有某个话题标签的帖子 | GET /api/hashtag/{id}/posts |
| 查找使用特定声音的帖子 | GET /api/music/{id}/posts |
每一行的完整参数详情:references/endpoints.md。
身份验证
两种付款方式,获取相同数据——完整机制请参阅 fetcher
技能:
# 1. Prepaid credits (recommended — get a key at https://fetcher.sh/topup
# or via POST /api/credits/topup, see the fetcher skill)
export FETCHER_API_KEY="bby_live_xxxxxxxxxxxx"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/post/search?keyword=hello"
# 2. x402 pay-per-call — omit the header; a GET with no payment returns 402
# with machine-readable payment requirements (USDC on Base, Polygon,
# Arbitrum, Monad, or Solana). @x402/fetch signs and retries automatically.
每个响应的格式均为 { "status": number, "message": string, "data": ... };HTTP 状态码与 status 一致。
端点(13 个——全部为 GET,每次调用 $0.004)
| 端点 | 返回内容 |
|---|---|
/api/post/search | 匹配关键词的帖子;支持排序和日期范围筛选 |
/api/post | 根据分享 URL 查找单个帖子 |
/api/post/{id} | 按 ID 查询单个帖子 |
/api/post/{id}/comments | 帖子的评论 |
/api/post/{id}/comments/{commentId}/replies | 对评论的回复 |
/api/user/handle/{username} | 按 @用户名查询个人资料 |
/api/user/{id}/posts | 用户的帖子 |
/api/user/{id}/followers | 用户的关注者 |
/api/user/{id}/followings | 用户关注的账号 |
/api/hashtag/handle/{name} | 按名称查询话题标签元数据 |
/api/hashtag/{id}/posts | 带有某个话题标签的帖子 |
/api/music/{id}/posts | 使用某个声音/音乐曲目的帖子 |
/api/location/{locationId}/posts | 标记了某个位置的帖子 |
{id} / {username} / {name} 是路径参数。可选查询参数(cursor、region)用于分页或限定地理范围;在对应端点中,keyword(搜索)和 url(查询帖子)为必填参数。
使用场景
本月获赞最多的帖子:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=ai agent" -G \
--data-urlencode "sortType=MOST_LIKED" \
--data-urlencode "dateRange=THIS_MONTH" \
"https://tiktok.fetcher.sh/api/post/search"
昨天发布,按最新排序:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
--data-urlencode "keyword=crypto payments" -G \
--data-urlencode "sortType=DATE_POSTED" \
--data-urlencode "dateRange=YESTERDAY" \
"https://tiktok.fetcher.sh/api/post/search"
其他 sortType 值:RELEVANCE。其他 dateRange 值:ALL_TIME、THIS_WEEK、LAST_THREE_MONTHS、LAST_SIX_MONTHS。
按分享 URL 或直接按 ID 查询帖子:
curl -H "Authorization: Bearer $FETCHER_API_KEY" -G \
--data-urlencode "url=https://www.tiktok.com/@username/video/1234567890123456789" \
"https://tiktok.fetcher.sh/api/post"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/post/1234567890123456789"
帖子的评论和评论回复:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/post/1234567890123456789/comments"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/post/1234567890123456789/comments/9876543210/replies"
按 @账号名查询个人资料,然后获取其帖子、关注者和关注列表:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/user/handle/khaby.lame"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/user/6935741396776976390/posts"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/user/6935741396776976390/followers"
查询话题标签的元数据,然后获取相关帖子:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/hashtag/handle/fyp"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/hashtag/1234567890/posts"
使用特定声音的帖子,以及来自某个位置的帖子:
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/music/1234567890123456789/posts"
curl -H "Authorization: Bearer $FETCHER_API_KEY" \
"https://tiktok.fetcher.sh/api/location/1234567890123456789/posts"
MCP
{
"mcpServers": {
"tiktok": {
"url": "https://tiktok.fetcher.sh/mcp",
"headers": { "Authorization": "Bearer bby_live_..." }
}
}
}
免费工具:search_endpoints、describe_endpoint、check_balance。付费工具:fetch_data(上方的任意端点)、topup_credits,以及名为 tiktok_post_search 的快捷工具。改用 x402 按次付费时,移除 headers 块——完整流程请参阅 fetcher 技能。
错误
400— 缺少或无效的参数(消息会指出具体参数)401— 未知或已轮换的密钥402— 需要付款(x402 挑战)或topup_required(额度已用尽)404— 非计价路径- 无速率限制;上游故障不退款(结算先于交付)
参考
- 深入了解:
references/endpoints.md(所有 参数) ·references/scenarios.md(每个端点一个curl示例) ·references/faq.md·references/comparison.md(与官方 TikTok API 和浏览器爬虫的对比) - 任务指南:热门帖子搜索 · 个人资料和关注者
- 斜杠命令:
/tiktok-search - 完整的 Agent 设置:https://tiktok.fetcher.sh/skill.md
- OpenAPI 3.1 契约:https://tiktok.fetcher.sh/openapi.json
- 精简目录:https://tiktok.fetcher.sh/llms.txt
- 付款、额度和 MCP 深入介绍:
fetcher技能 - 网站:https://tiktok.fetcher.sh