TikTok Video Analyzer
Use the bundled Playwright runner to open one TikTok video detail page in a local browser, extract publicly visible video metadata plus any platform caption track, collect visible top-level comments, and write an insight-oriented Markdown report into the current working directory.
Preconditions
- Launch a local headed Chrome session by default. Treat this as browser automation, not a pure sandbox CLI task.
- Request browser-launch approval up front for the first real run in a restricted environment.
- Use one public TikTok video URL per run.
- Prefer anonymous browsing first, but allow normal browser cookies if TikTok serves richer page data that way.
- Allow a local proxy via environment variable when needed.
- Do not automate login, CAPTCHA solving, or hidden APIs.
- Do not run Whisper or any other ASR fallback in this skill.
- Treat comments as best-effort evidence. If caption extraction succeeds but comments are blocked or unavailable, write a partial report instead of failing the whole run.
Install
Install the runner dependencies once:
cd "$HOME/.codex/skills/tiktok-video-analyzer/scripts"
npm install
Only if Chromium fallback is needed:
npx playwright install chromium
Command
Run the wrapper script:
"$HOME/.codex/skills/tiktok-video-analyzer/scripts/analyze_video" \
--video-url "https://www.tiktok.com/@fiona_in_guangzhou/video/7480362031934115102"
Optional flags:
--slow-mo MS
--timeout-ms MS
--headless
--max-comments N
--comment-scrolls N
Optional environment variables:
TIKTOK_ANALYZER_PROXY
https_proxy
http_proxy
all_proxy
Use --help on the wrapper for the latest usage text.
Workflow
- Validate the video URL and derive
video_id and creator handle from the public URL.
- Launch a local Chrome session with Playwright and light stealth settings.
- Open the TikTok video detail page, wait for the page to stabilize, dismiss obvious modals, and detect blocker states early.
- Collect page JSON from
__UNIVERSAL_DATA_FOR_REHYDRATION__, SIGI_STATE, and __NEXT_DATA__, while also recording small JSON and caption-like network responses.
- Build metadata from structured page data first, then use page metadata fallbacks only for fields already visible on the page.
- Extract one platform caption track from structured data or captured responses. If no platform caption is available, fail with
该视频没有可提取的平台字幕.
- Collect visible top-level comments. Prefer structured data and captured responses, then use DOM fallback only for fields already visible on the page.
- Rank hot comments, group common audience questions, classify conversion signals, and derive evidence-based insights.
- Write the Markdown report into the current working directory.
Output Contract
- Output directory: current working directory.
- Output filename:
tiktok.{author}.{description}.md
- Markdown layout:
# TikTok 视频分析
## 基本信息
## 视频描述
## Hashtags
## 口播文案
## 评论区概览
## 核心热评
## 用户最关心的问题
## 洞见总结
## 转化信号判断
- Keep
## 口播文案 for platform-provided caption text only. Do not label it as a transcript.
- In
## 评论区概览, include the comment-analysis status, sample size, and any blockers or collection problems.
- In
## 核心热评, include representative top-level comments with evidence fields such as likes, replies, or pinned status when available.
- In
## 用户最关心的问题, group questions by concrete themes instead of listing raw comments only.
- In
## 洞见总结, prefer evidence-backed findings over generic marketing language.
Failure Handling
- If TikTok redirects to login, challenge, or other blockers before caption extraction succeeds, fail clearly with the blocker reason.
- If metadata is available but no platform caption track is found, fail clearly with
该视频没有可提取的平台字幕.
- If caption extraction succeeds but comments are blocked or unavailable, write a partial report that keeps the caption and metadata sections and explains the comment limitation.
- If TikTok changes the page structure, update
scripts/analyze_video.mjs instead of inventing ad hoc selectors in the conversation.
References
- Field mapping and output rules:
references/field-map.md
- Comment scoring, question grouping, and conversion heuristics:
references/insight-rubric.md
1---2name: tiktok-video-analyzer3description: Analyze one public TikTok video URL by extracting video metadata, platform-provided caption text, and visible top-level comment signals, then write a Markdown report with hot comments, audience questions, conversion signals, and practical insights. Use when Codex receives a TikTok video link and needs more than caption extraction, especially for comment analysis, audience intent understanding, or conversion-oriented insight.4---56# TikTok Video Analyzer78Use the bundled Playwright runner to open one TikTok video detail page in a local browser, extract publicly visible video metadata plus any platform caption track, collect visible top-level comments, and write an insight-oriented Markdown report into the current working directory.910## Preconditions1112- Launch a local headed Chrome session by default. Treat this as browser automation, not a pure sandbox CLI task.13- Request browser-launch approval up front for the first real run in a restricted environment.14- Use one public TikTok video URL per run.15- Prefer anonymous browsing first, but allow normal browser cookies if TikTok serves richer page data that way.16- Allow a local proxy via environment variable when needed.17- Do not automate login, CAPTCHA solving, or hidden APIs.18- Do not run Whisper or any other ASR fallback in this skill.19- Treat comments as best-effort evidence. If caption extraction succeeds but comments are blocked or unavailable, write a partial report instead of failing the whole run.2021## Install2223Install the runner dependencies once:2425```bash26cd "$HOME/.codex/skills/tiktok-video-analyzer/scripts"27npm install28```2930Only if Chromium fallback is needed:3132```bash33npx playwright install chromium34```3536## Command3738Run the wrapper script:3940```bash41"$HOME/.codex/skills/tiktok-video-analyzer/scripts/analyze_video" \42 --video-url "https://www.tiktok.com/@fiona_in_guangzhou/video/7480362031934115102"43```4445Optional flags:4647- `--slow-mo MS`48- `--timeout-ms MS`49- `--headless`50- `--max-comments N`51- `--comment-scrolls N`5253Optional environment variables:5455- `TIKTOK_ANALYZER_PROXY`56- `https_proxy`57- `http_proxy`58- `all_proxy`5960Use `--help` on the wrapper for the latest usage text.6162## Workflow63641. Validate the video URL and derive `video_id` and creator handle from the public URL.652. Launch a local Chrome session with Playwright and light stealth settings.663. Open the TikTok video detail page, wait for the page to stabilize, dismiss obvious modals, and detect blocker states early.674. Collect page JSON from `__UNIVERSAL_DATA_FOR_REHYDRATION__`, `SIGI_STATE`, and `__NEXT_DATA__`, while also recording small JSON and caption-like network responses.685. Build metadata from structured page data first, then use page metadata fallbacks only for fields already visible on the page.696. Extract one platform caption track from structured data or captured responses. If no platform caption is available, fail with `该视频没有可提取的平台字幕`.707. Collect visible top-level comments. Prefer structured data and captured responses, then use DOM fallback only for fields already visible on the page.718. Rank hot comments, group common audience questions, classify conversion signals, and derive evidence-based insights.729. Write the Markdown report into the current working directory.7374## Output Contract7576- Output directory: current working directory.77- Output filename: `tiktok.{author}.{description}.md`78- Markdown layout:79 - `# TikTok 视频分析`80 - `## 基本信息`81 - `## 视频描述`82 - `## Hashtags`83 - `## 口播文案`84 - `## 评论区概览`85 - `## 核心热评`86 - `## 用户最关心的问题`87 - `## 洞见总结`88 - `## 转化信号判断`89- Keep `## 口播文案` for platform-provided caption text only. Do not label it as a transcript.90- In `## 评论区概览`, include the comment-analysis status, sample size, and any blockers or collection problems.91- In `## 核心热评`, include representative top-level comments with evidence fields such as likes, replies, or pinned status when available.92- In `## 用户最关心的问题`, group questions by concrete themes instead of listing raw comments only.93- In `## 洞见总结`, prefer evidence-backed findings over generic marketing language.9495## Failure Handling9697- If TikTok redirects to login, challenge, or other blockers before caption extraction succeeds, fail clearly with the blocker reason.98- If metadata is available but no platform caption track is found, fail clearly with `该视频没有可提取的平台字幕`.99- If caption extraction succeeds but comments are blocked or unavailable, write a partial report that keeps the caption and metadata sections and explains the comment limitation.100- If TikTok changes the page structure, update `scripts/analyze_video.mjs` instead of inventing ad hoc selectors in the conversation.101102## References103104- Field mapping and output rules: `references/field-map.md`105- Comment scoring, question grouping, and conversion heuristics: `references/insight-rubric.md`