返回顶部
t

tiktok-pageTikTok管理

TikTok manager: post videos, list content & check account stats. Requires: powershell/pwsh. Reads ~/.config/tiktok-page/credentials.json (TIKTOK_ACCESS_TOKEN, TIKTOK_REFRESH_TOKEN, TIKTOK_CLIENT_KEY, TIKTOK_CLIENT_SECRET, TIKTOK_OPEN_ID). Tokens expire every 24h — auto-refresh via TIKTOK_REFRESH_TOKEN. Grant minimal permissions only. Rotate immediately if host is compromised. No data forwarded; all calls go to open.tiktokapis.com only.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.4
安全检测
已通过
712
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

tiktok-page

tiktok-page — 通用 TikTok API 技能

根据用户需求,内联构建并执行 TikTok API 调用。无需脚本。

API 基础 URL:https://open.tiktokapis.com/v2



第一步 - 加载凭据

凭据存储在 ~/.config/tiktok-page/credentials.json 中。

powershell
$cfg = Get-Content $HOME/.config/tiktok-page/credentials.json -Raw | ConvertFrom-Json
$accessToken = $cfg.TIKTOKACCESSTOKEN
$refreshToken = $cfg.TIKTOKREFRESHTOKEN
$clientKey = $cfg.TIKTOKCLIENTKEY
$clientSecret = $cfg.TIKTOKCLIENTSECRET
$openId = $cfg.TIKTOKOPENID

如果文件不存在,请引导设置:

字段用途
TIKTOKACCESSTOKENOAuth2 访问令牌 — 用于所有 API 调用
TIKTOKREFRESHTOKEN
用于在访问令牌过期时刷新 |
| TIKTOKCLIENTKEY | 来自 TikTok 开发者门户的应用客户端密钥 |
| TIKTOKCLIENTSECRET | 应用客户端密钥 — 仅用于令牌刷新 |
| TIKTOKOPENID | OAuth 期间返回的 TikTok 用户 open_id |

一次性 OAuth2 设置:

  1. 1. 访问 https://developers.tiktok.com — 创建或选择你的应用
  2. 添加重定向 URI(例如 https://localhost 或你的回调 URL)
  3. 记下你的客户端密钥和客户端密钥
  4. 引导用户访问:
https://www.tiktok.com/v2/auth/authorize/?clientkey=CLIENTKEY&redirecturi=REDIRECTURI&response_type=code&scope=user.info.basic,video.list,video.publish,video.upload,comment.list&state=random
  1. 5. 重定向后,从回调 URL 中复制 code 参数

powershell

用授权码交换令牌


$clientKey = <你的客户端密钥>
$clientSecret = <你的客户端密钥>
$code = <来自重定向的授权码>
$redirectUri = <你的重定向 URI>

$body = clientkey=$clientKey&clientsecret=$clientSecret&code=$code&granttype=authorizationcode&redirect_uri=$redirectUri
$r = Invoke-RestMethod https://open.tiktokapis.com/v2/oauth/token/ -Method POST
-Headers @{ Content-Type = application/x-www-form-urlencoded } -Body $body -ErrorAction Stop

New-Item -ItemType Directory -Force -Path $HOME/.config/tiktok-page | Out-Null
@{
TIKTOKACCESSTOKEN = $r.access_token
TIKTOKREFRESHTOKEN = $r.refresh_token
TIKTOKCLIENTKEY = $clientKey
TIKTOKCLIENTSECRET = $clientSecret
TIKTOKOPENID = $r.open_id
} | ConvertTo-Json | Set-Content $HOME/.config/tiktok-page/credentials.json -Encoding UTF8

保存后立即限制文件权限:
powershell

Windows


icacls $HOME/.config/tiktok-page/credentials.json /inheritance:r /grant:r $($env:USERNAME):(R,W)

macOS / Linux


chmod 600 ~/.config/tiktok-page/credentials.json

切勿将此文件提交到版本控制。它包含长期有效的密钥。
此技能仅向 open.tiktokapis.com 发出外部调用。不会将数据转发给第三方。


第二步 - 令牌刷新

TikTok 访问令牌在 24 小时后过期。如有需要,在调用前刷新:

powershell
$cfg = Get-Content $HOME/.config/tiktok-page/credentials.json -Raw | ConvertFrom-Json
$body = clientkey=$($cfg.TIKTOKCLIENTKEY)&clientsecret=$($cfg.TIKTOKCLIENTSECRET)&granttype=refreshtoken&refreshtoken=$($cfg.TIKTOKREFRESH_TOKEN)
$r = Invoke-RestMethod https://open.tiktokapis.com/v2/oauth/token/ -Method POST
-Headers @{ Content-Type = application/x-www-form-urlencoded } -Body $body -ErrorAction Stop

$cfg.TIKTOKACCESSTOKEN = $r.access_token
$cfg.TIKTOKREFRESHTOKEN = $r.refresh_token
$cfg | ConvertTo-Json | Set-Content $HOME/.config/tiktok-page/credentials.json -Encoding UTF8
Write-Host 令牌已刷新。



第三步 - 确定 API 调用

常用端点

用户需求方法端点
获取账户信息POST/user/info/
列出自己的视频
POST | /video/list/ | | 获取视频详情 | POST | /video/query/ | | 获取评论 | GET | /video/comment/list/?video_id={id} | | 从 URL 发布视频 | POST | /post/publish/video/init/ 配合 PULLFROMURL | | 从文件上传视频 | POST 然后 PUT | /post/publish/video/init/ 然后 upload_url | | 检查发布状态 | GET | /post/publish/status/fetch/?publish_id={id} |

API 调用模式

GET 账户信息:
powershell
$cfg = Get-Content $HOME/.config/tiktok-page/credentials.json -Raw | ConvertFrom-Json
$headers = @{ Authorization = Bearer $($cfg.TIKTOKACCESSTOKEN); Content-Type = application/json; charset=UTF-8 }
$body = @{ fields = displayname,avatarurl,followercount,followingcount,likescount,videocount } | ConvertTo-Json
$result = Invoke-RestMethod https://open.tiktokapis.com/v2/user/info/ -Method POST -Headers $headers -Body $body -ErrorAction Stop
$result.data.user

列出视频:
powershell
$cfg = Get-Content $HOME/.config/tiktok-page/credentials.json -Raw | ConvertFrom-Json
$headers = @{ Authorization = Bearer $($cfg.TIKTOKACCESSTOKEN); Content-Type = application/json; charset=UTF-8 }
$body = @{ maxcount = 20; fields = id,title,createtime,coverimageurl,shareurl,viewcount,likecount,commentcount,share_count } | ConvertTo-Json
$result = Invoke-RestMethod https://open.tiktokapis.com/v2/video/list/ -Method POST -Headers $headers -Body $body -ErrorAction Stop
$result.data.videos | Format-Table id, title, viewcount, likecount, create_time

按 ID 获取视频详情:
powershell
$cfg = Get-Content $HOME/.config/tiktok-page/credentials.json -Raw | ConvertFrom-Json
$headers = @{ Authorization = Bearer $($cfg.TIKTOKACCESSTOKEN); Content-Type = application/json; charset=UTF-8 }
$body = @{ filters = @{ videoids = @(id>) }; fields = id,title,viewcount,likecount,commentcount,sharecount,embed_html } | ConvertTo-Json -Depth 4
$result = Invoke-RestMethod https://open.tiktokapis.com/v2/video/query/ -Method POST -Headers $headers -Body $body -ErrorAction Stop
$result.data.videos

从 URL 发布视频:
powershell
$cfg = Get-Content $HOME/.config/tiktok-page/credentials.json -Raw | ConvertFrom-Json
$headers = @{ Authorization = Bearer $($cfg.TIKTOKACCESSTOKEN); Content-Type = application/json; charset=UTF-8 }
$body = @{
post_info = @{
title = 你的视频标题
privacylevel = PUBLICTO_EVERYONE
disable_duet = $false
disable_stitch = $false
disable_comment = $false
}
source_info = @{
source = PULLFROMURL
video_url = https://example.com/video.mp4
video_size = 12345678
chunk_size = 10000000
totalchunkcount = 1
}
} | ConvertTo-Json -Depth 5
$result = Invoke-RestMethod https://open.tikt

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 tiktok-page-1776287724 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 tiktok-page-1776287724 技能

通过命令行安装

skillhub install tiktok-page-1776287724

下载

⬇ 下载 tiktok-page v1.0.4(免费)

文件大小: 4.42 KB | 发布时间: 2026-4-16 17:36

v1.0.4 最新 2026-4-16 17:36
Improved description for discoverability

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部