Skip to main content
skill CX Codex

extracting-youtube-comments-for-research — Claude Code skill: pull

Pulls YouTube comments from videos and channels through Apify, then sorts them into themes, questions and sentiment. Useful when you need to know what viewers actually say.

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

What extracting-youtube-comments-for-research does

The skill runs the apidojo/youtube-comments-scraper actor on Apify and returns comment text, like count, reply count, commenter username and timestamp. Input accepts video, channel, playlist and Shorts URLs, handles like @kurzgesagt, keywords or trending. Filters cover country (gl), language (hl), upload date, duration and features such as 4k or live.

Cleaning comes next: comments under 8 words, self-promo with external links and the creator's own replies get dropped. Analysis follows the goal — questions are matched on question marks and phrasing like "how do you", pain points on "I can't" and "doesn't work", sentiment through a standard lexical classifier. Comment weight combines likes and replies, so the top of the list reflects what landed with the audience.

You need the APIFY_TOKEN environment variable set, otherwise the scripts will not run. Three routes exist: scripts/run_actor.js with CSV or JSON output, an Apify MCP server call, or a direct REST request. When comments are disabled or few rows come back, the skill suggests trying another video from the same channel. On channels where viewers barely write, the report comes out empty — worth checking before you plan research around it.

What it helps with

  • collect comments from several videos into one dataset
  • find recurring viewer questions before making a video
  • score sentiment in product feedback comments
  • surface the most-liked comments for review
  • filter spam and self-promo out of a scrape

Example prompts for the agent

  • scrape the comments on this video and show the top 10 by likes
  • what questions do viewers ask most in the comments?
  • analyze the sentiment of comments from @kurzgesagt

How to install extracting-youtube-comments-for-research

1Skills CLI (Vercel)

npx skills add apidojo-io/apidojo-skills --skill extracting-youtube-comments-for-research -a claude-code

2Manually: put the files in place

~/.claude/skills/extracting-youtube-comments-for-research/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/extracting-youtube-comments-for-research/

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

Questions about extracting-youtube-comments-for-research

How do I install extracting-youtube-comments-for-research in Claude?

Run npx skills add apidojo-io/apidojo-skills --skill extracting-youtube-comments-for-research -a claude-code. The skill file then lives at ~/.claude/skills/extracting-youtube-comments-for-research/SKILL.md.

What does extracting-youtube-comments-for-research do?

It runs a YouTube comment scraper on Apify and returns text, likes, reply count, username and timestamp. Then it cleans the dataset and analyzes it by theme, question or sentiment.

What do I need before running it?

The APIFY_TOKEN environment variable. You can also install the Apify MCP server and call it through the apify:run-actor tool.

Source text

SKILL.md · Apache-2.0
---
name: extracting-youtube-comments-for-research
description: >
  Extracts and analyzes YouTube comments for audience research using apidojo's YouTube scraper on Apify.
  Triggers when the user asks to: extract YouTube comments for research, analyze what viewers say
  in YouTube comments, scrape comments from a YouTube video for sentiment analysis, find common
  questions in YouTube comments, research audience feedback from YouTube video comments, extract
  top comments from a YouTube channel for audience insights, or analyze viewer reactions from
  YouTube comment sections.
  Returns comment text, likes on comment, reply count, commenter username, and timestamp.
  Ideal for content creators, brand researchers, product teams, and audience insight analysts.
license: Apache-2.0
metadata:
  author: apidojo
  version: "1.0"
  apify-actor: apidojo/youtube-scraper
---

# Extracting YouTube Comments for Research

Pulls YouTube video comments for sentiment analysis, question mining, and product feedback. YouTube comments are more considered than TikTok — viewers invest more time before commenting.

## Prerequisites

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

## Inputs

| Parameter | Type | Required | Default | Notes |
|-----------|------|----------|---------|-------|
| `startUrls` | array | Optional | `[]` | YouTube URLs — channels, playlists, Shorts, search results |
| `youtubeHandles` | array | Optional | `[]` | YouTube channel handles (e.g. `@kurzgesagt`) |
| `getTrending` | boolean | Optional | `false` | Retrieve trending videos |
| `keywords` | array | Optional | `[]` | Search keywords |
| `gl` | string | Optional | `us` | Country code for results (e.g. `US`, `GB`) |
| `hl` | string | Optional | `en` | Language code (e.g. `en`, `de`) |
| `uploadDate` | string | Optional | `all` | Upload date filter: `any`, `hour`, `today`, `week`, `month`, `year` |
| `duration` | string | Optional | `all` | Duration filter: `any`, `short`, `long` |
| `features` | string | Optional | `all` | Feature filter: `4k`, `hd`, `live`, `cc`, `3d`, `hdr`, etc. |
| `sort` | string | Optional | `r` | Sort order for search results |
| `maxItems` | number | Optional | Unlimited | Maximum videos to return |
| `customMapFunction` | string | Optional | — | JavaScript function to transform each output object |

## Workflow

```
Progress:
- [ ] Step 1: Scrape comments from target videos
- [ ] Step 2: Filter and clean dataset
- [ ] Step 3: Analyze by research goal
- [ ] Step 4: Extract top themes and insights
- [ ] Step 5: Deliver comment research report
```

### Step 1: Scrape Comments


**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~youtube-comments-scraper" \
  --input '{"param": "value"}'

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

# Save as JSON
node scripts/run_actor.js \
  --actor "apidojo~youtube-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~youtube-comments-scraper"
Input:
{
  "startUrls": [{"url": "[VIDEO_URL_1]"}, {"url": "[VIDEO_URL_2]"}],
  "type": "comments",
  "maxComments": 500
}
```

**REST API fallback:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~youtube-comments-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": [{"url": "[VIDEO_URL]"}], "type": "comments", "maxComments": 500}'
```

### Step 2: Clean Dataset

- Remove comments < 8 words (usually emoji-only or "great video!")
- Remove self-promotional comments (contain external links)
- Remove creator's own replies (match `authorName` to channel name)
- Apply `min_likes_on_comment` filter if set

### Step 3: Analyze by Goal

**Questions:** Contains "?", "how do you", "what is", "can you"
**Pain points:** "I struggle", "I can't", "problem is", "doesn't work"
**Product feedback:** Product mentions + opinion signals
**Sentiment:** Standard lexical classifier (positive/negative/neutral)

```
comment_importance = likeCount * 0.60 + replyCount * 10 * 0.40
```

### Step 4: Edge Cases

- **Comments disabled**: Note; try different video from same channel
- **Mostly non-English**: Report language distribution; filter to English if needed
- **Spam invasion**: Filter where same username appears > 3 times
- **Brigaded comment section**: > 50% share coordinated theme → flag as BRIGADED

## Output Format

```
# YouTube Comment Analysis
Videos: [N] | Comments analyzed: [N] | After filtering: [N] | Date: [DATE]

## Sentiment (if goal = sentiment)
Positive: [X%] | Negative: [X%] | Neutral: [X%]

## Top 10 Most-Liked Comments
| # | Comment (excerpt) | Likes | Replies |
|---|------------------|-------|---------|

## Key Themes
| Theme | Frequency | Avg Likes | Example |
|-------|-----------|-----------|---------|

## Most Asked Questions
1. "[question]" — [N] viewers
```

## Troubleshooting

**Few comments returned**: YouTube limits access for some videos; try high-comment video from same channel.
**Mostly surface-level praise**: Use `min_likes_on_comment = 5` to filter for substantive comments.
**Research goal not present**: Audience may not engage that way on YouTube; try Reddit or TikTok for this niche.

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

Similar skills

All skills for Browser and scraping →

From the same set22

scraping-tiktok-profile-data Pulls TikTok profile stats and metadata for a batch of accounts: followers, following, total likes, video count, bio. Handy when you need to vet a creator list. CX Codex +1 834installs finding-instagram-creators-by-location Finds Instagram creators who post from a given city, venue or neighborhood. Useful for geo-targeted campaigns and regional partnerships. CX Codex +1 833installs scraping-instagram-location-content Pulls public Instagram posts tagged at one place and returns post URLs, captions, handles, likes and dates. Useful when you want to see what visitors post about a venue. CX Codex +1 810installs analyzing-competitor-instagram-content-strategy This skill pulls a competitor's recent Instagram posts and shows which formats and themes earn them engagement. Useful when you need to read someone else's content plan. CX Codex +1 796installs monitoring-vc-investor-activity-on-twitter This skill pulls investor tweets through apidojo's scraper, classifies the accounts and scores deal signals. Useful when you are raising. CX Codex +1 789installs tracking-twitter-thought-leaders Finds Twitter/X accounts whose posts on a topic actually get shared, then hands back a ranked list for PR and partnerships. CX Codex +1 786installs monitoring-twitter-for-competitor-job-posts Tracks competitor hiring tweets on X and turns them into growth signals: who is hiring, for what role, and when. CX Codex +1 786installs 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

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