Skip to main content
skill CX Codex

scraping-tiktok-comments — Claude Code skill: pull TikTok comments

Exports the comment dataset of any TikTok video through apidojo's scraper on Apify: author, text, likes, replies, timestamp. Handy when you need to read what viewers actually wrote.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add apidojo-io/apidojo-skills --skill scraping-tiktok-comments -a claude-code
Open on GitHub

What scraping-tiktok-comments does

Point the skill at one or more TikTok video URLs and it hands back a dataset with id, text, authorUsername, diggCount, replyCount, createTime, isReply and parentCommentId. Nested replies stay out unless you flip includeReplies on. Cap the volume with maxItems.

The bundled scripts/run_actor.js starts the apidojo~tiktok-comments-scraper actor, waits for it to finish and writes CSV or JSON for you. Two fallbacks exist: the Apify MCP server with the apify:run-actor tool, or plain REST calls where you keep the returned RUN_ID and poll the run status yourself.

APIFY_TOKEN has to be present in the environment or a .env file, otherwise the script never starts. Videos with comments turned off or set to private come back empty, and a deleted video throws an error — drop that URL from the batch. Expect fewer comments than the app shows, because TikTok filters spam server-side.

What it helps with

  • export every comment under a viral TikTok clip
  • collect comment text and likes for sentiment work
  • track what people say under a brand's posts
  • grab reply threads together with their parent comments
  • save a comment dataset as CSV for a spreadsheet

Example prompts for the agent

  • Scrape the comments on this TikTok video: https://www.tiktok.com/@user/video/123456
  • Pull comments with includeReplies: true and save them to 2025-01-01_results.csv
  • Run apidojo~tiktok-comments-scraper on these URLs, 200 comments max

How to install scraping-tiktok-comments

1Skills CLI (Vercel)

npx skills add apidojo-io/apidojo-skills --skill scraping-tiktok-comments -a claude-code

2Manually: put the files in place

~/.claude/skills/scraping-tiktok-comments/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/scraping-tiktok-comments/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about scraping-tiktok-comments

How do I install scraping-tiktok-comments in Claude Code?

Run npx skills add apidojo-io/apidojo-skills --skill scraping-tiktok-comments -a claude-code. The skill lands at ~/.claude/skills/scraping-tiktok-comments/SKILL.md.

What does scraping-tiktok-comments do?

It runs the apidojo~tiktok-comments-scraper actor on Apify and returns TikTok comments with author, text, likes, reply count and timestamp. Replies are opt-in.

What do I need before using it?

An APIFY_TOKEN environment variable. If you have the Apify MCP server installed, the run can go through the apify:run-actor tool instead.

Source text

SKILL.md · Apache-2.0
---
name: scraping-tiktok-comments
description: >
  Scrapes comments from any TikTok video using apidojo's TikTok Comments scraper on Apify.
  Triggers when the user asks to: get all comments on a TikTok video, export TikTok comment
  data, scrape what viewers are saying on a TikTok post, fetch comment text and likes from
  a TikTok URL, collect TikTok comment threads for analysis, or download comments from a
  viral TikTok video. Returns commenter username, comment text, like count, reply count,
  and timestamp per comment.
  Ideal for sentiment analysts, brand monitors, and content researchers.
license: Apache-2.0
metadata:
  author: apidojo
  version: "1.0"
  apify-actor: apidojo/tiktok-comments-scraper
---

# Scraping TikTok Comments

Exports all comments from any TikTok video URL. Returns the raw comment dataset for sentiment analysis, community research, or product feedback extraction.

## Prerequisites

- `APIFY_TOKEN` environment variable set
- Optional: Apify MCP server installed

## Inputs

| Parameter | Type | Required | Default | Notes |
|-----------|------|----------|---------|-------|
| `startUrls` | array | ✅ | `[]` | TikTok video URLs to scrape comments from |
| `includeReplies` | boolean | Optional | `false` | Include reply comments (nested) |
| `maxItems` | number | Optional | Unlimited | Maximum comments to return |
| `customMapFunction` | string | Optional | — | JavaScript function to transform each output object |

## Workflow

```
Progress:
- [ ] Step 1: Validate video URLs
- [ ] Step 2: Run tiktok-comments-scraper
- [ ] Step 3: Poll for SUCCEEDED
- [ ] Step 4: Deliver comment dataset
```

### Step 2: Run the Actor


**Recommended — run_actor.js (handles waiting, output, and file saving automatically):**
```bash
# Quick answer (prints table to chat)
node scripts/run_actor.js \
  --actor "apidojo~tiktok-comments-scraper" \
  --input '{"param": "value"}'

# Save as CSV
node scripts/run_actor.js \
  --actor "apidojo~tiktok-comments-scraper" \
  --input '{"param": "value"}' \
  --output YYYY-MM-DD_results.csv --format csv

# Save as JSON
node scripts/run_actor.js \
  --actor "apidojo~tiktok-comments-scraper" \
  --input '{"param": "value"}' \
  --output YYYY-MM-DD_results.json --format json
```
> `APIFY_TOKEN` must be set in environment or `.env` file.

**If Apify MCP is available:**
```
Tool: apify:run-actor
Actor: "apidojo~tiktok-comments-scraper"
Input:
{
  "videoUrls": ["https://www.tiktok.com/@user/video/123456"],
  "maxItems": 200,
  "includeReplies": false
}
```

**REST API fallback:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tiktok-comments-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls": ["<url>"], "maxItems": 200}'
```

Save `id` as `RUN_ID`. Poll until `status = SUCCEEDED`:
```bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'
```

Fetch results:
```bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"
```

### Step 3: Handle Edge Cases

- **0 comments**: Video may have comments disabled or be private. Report to user.
- **Video deleted or unavailable**: Actor returns error — remove URL from batch and notify.
- **Comment count less than expected**: TikTok filters spam comments server-side; this is expected.

## Output Format

```
# TikTok Comment Dataset
Video: <url> | Comments collected: N | Includes replies: YES/NO

| Comment ID | Author | Text | Likes | Replies | Timestamp |
|------------|--------|------|-------|---------|-----------|
| ...        | ...    | ...  | ...   | ...     | ...       |

Available fields: id, text, authorUsername, diggCount, replyCount, createTime,
isReply, parentCommentId
```

## Troubleshooting

**Comments disabled:** Creator has disabled comments — no workaround.
**Truncated comments:** Some comments may be cut off by TikTok's API; full text available via video page.

© apidojo · Apache-2.0 · apidojo-io/apidojo-skills

Similar skills

All skills for Browser and scraping →

From the same set57

tracking-sports-team-fan-sentiment-twitter Collects tweets about a sports team and measures fan sentiment. Use it to study reactions to games, team news, player trades, and events. CX Codex +1 785installs analyzing-competitor-twitter-profile-content This skill pulls a competitor's or brand's tweet history through Apify and ranks posts by engagement. Useful when you need to see what a rival actually posts. CX Codex +1 784installs finding-podcast-hosts-for-outreach Find podcast hosts for PR and guest pitches through Apify Twitter scrapers. Use it when you need a topic-focused outreach list. CX Codex +1 782installs building-journalist-outreach-list-from-twitter Builds journalist and media contact lists for a given beat by scraping Twitter/X through Apify. Useful when you need names before a press pitch. CX Codex +1 780installs discovering-viral-tiktok-content-trends This skill finds viral TikTok formats in a chosen niche and breaks down hashtags, reach, engagement, and hooks. Use it when planning content angles. CX Codex +1 777installs analyzing-competitor-youtube-content-strategy Audits a competitor’s YouTube strategy by topic, format, publishing cadence, views, and engagement. Use it to compare two channels or find content gaps. CX Codex +1 776installs finding-ecommerce-brands-for-outreach Builds a list of e-commerce and DTC brands on Instagram and TikTok by product-category hashtags. Useful when you need an outreach list instead of scrolling profiles by hand. CX Codex +1 776installs analyzing-competitor-tiktok-content-strategy This skill examines a competitor’s TikTok account, covering videos, posting cadence, hashtags, hooks, and engagement. Use it for content strategy research. CX Codex +1 771installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor