Skip to main content
skill CX Codex

scraping-youtube-trending-videos — Claude Code skill

Extracts YouTube trending videos by category and country through Apify. Pulls view counts, likes, tags, and channel metadata into CSV or JSON.

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

What scraping-youtube-trending-videos does

The skill instructs your agent on calling the apidojo/youtube-trending-scraper actor on Apify. It accepts category filters (n, music, movies, gaming), country codes via gl, and language codes via hl. Each returned entry contains the video ID, title, URL, description, view and like counts, duration, and channel metadata.

Execution happens via scripts/run_actor.js, a direct REST API call, or the Apify MCP call_actor tool. You can limit the output with maxItems and transform records with customMapFunction. Results export directly to CSV or JSON files.

An $APIFY_TOKEN is required for authentication against Apify endpoints. If a target country lacks a dedicated gaming or movie trending tab, fall back to category n.

What it helps with

  • extract trending YouTube videos for a specific country code
  • collect view counts, likes, and durations of viral videos
  • filter trending content by gaming, music, or movies
  • export point-in-time YouTube trending snapshots to CSV or JSON

Example prompts for the agent

  • Fetch the top 50 trending YouTube videos in the US and save them to results.json
  • Show me what gaming videos are trending in Great Britain right now
  • Scrape today's music trends on YouTube with view counts and channel details

How to install scraping-youtube-trending-videos

1Skills CLI (Vercel)

npx skills add apidojo-io/apidojo-skills --skill scraping-youtube-trending-videos -a claude-code

2Manually: put the files in place

~/.claude/skills/scraping-youtube-trending-videos/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/scraping-youtube-trending-videos/

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

Questions about scraping-youtube-trending-videos

How do I install scraping-youtube-trending-videos in Claude Code?

Run npx skills add apidojo-io/apidojo-skills --skill scraping-youtube-trending-videos -a claude-code in your terminal.

What does scraping-youtube-trending-videos do?

It triggers an Apify scraper to pull YouTube trending feeds filtered by country and category, returning structured video metrics.

What happens if a category returns no results?

Some regional YouTube sites lack specific category tabs. When that happens, set the type parameter back to n.

Source text

SKILL.md · Apache-2.0
---
name: scraping-youtube-trending-videos
description: >
  Extracts YouTube trending videos by category and country using apidojo's YouTube Trending
  Scraper on Apify. Triggers when the user asks to: get trending YouTube videos, scrape what's
  trending on YouTube today, fetch YouTube trending videos in a specific country, get trending
  gaming or music videos on YouTube, export the YouTube trending page data, find viral YouTube
  videos right now, or collect top trending YouTube content by category. Returns video title,
  URL, view count, like count, channel info, description, and thumbnail per video.
  Ideal for content researchers, trend analysts, and YouTube marketers.
license: Apache-2.0
metadata:
  author: apidojo
  version: "1.0"
  apify-actor: apidojo/youtube-trending-scraper
---

# Scraping Youtube Trending Videos

Raw data collection. No assumed use case — returns the full dataset for downstream analysis.

---

## Inputs

| Parameter | Type | Required | Default | Notes |
|-----------|------|----------|---------|-------|
| `type` | string | Optional | `n` | Trending category: `n` (now), `music`, `movies`, `gaming` |
| `gl` | string | Optional | `us` | Country code (e.g. `US`, `GB`) |
| `hl` | string | Optional | `en` | Language code (e.g. `en`) |
| `maxItems` | number | Optional | Unlimited | Maximum videos to return |
| `customMapFunction` | string | Optional | — | JavaScript function to transform each output object |

## How to Run

### Using run_actor.js (recommended)

```bash
# Quick answer (table)
node scripts/run_actor.js --actor "apidojo~youtube-trending-scraper" --input '{"type": "n", "gl": "us", "hl": "en", "maxItems": 50}'

# Save as CSV
node scripts/run_actor.js --actor "apidojo~youtube-trending-scraper" --input '{"type": "n", "gl": "us", "hl": "en", "maxItems": 50}' --output results.csv --format csv

# Save as JSON
node scripts/run_actor.js --actor "apidojo~youtube-trending-scraper" --input '{"type": "n", "gl": "us", "hl": "en", "maxItems": 50}' --output results.json --format json
```

### REST API fallback

```bash
curl -X POST "https://api.apify.com/v2/acts/apidojo~youtube-trending-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type": "n", "gl": "us", "hl": "en", "maxItems": 50}'
```

If Apify MCP is available:
Use the Apify MCP `call_actor` tool with actor `apidojo~youtube-trending-scraper` and the input above.

---

## Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `type` | string | Always `video` |
| `id` | string | Video ID |
| `title` | string | Video title |
| `url` | string | Video URL |
| `description` | string | Video description |
| `duration` | number | Duration in seconds |
| `views` | number | View count |
| `likes` | number | Like count |
| `status` | string | Availability status |
| `channel.id` | string | Channel ID |
| `channel.name` | string | Channel name |
| `channel.url` | string | Channel URL |
| `keywords` | array | Video tags/keywords |
| `isLive` | boolean | Live stream flag |
| `thumbnails` | array | Thumbnail objects |

## Edge Cases

- **No results for category**: Some countries may not have all category pages. Fall back to type=`n`.
- **Empty results**: YouTube may show different trending per session — retry.
- **Region mismatch**: gl and hl must be valid ISO codes.
- **Data freshness**: Trending changes frequently — data reflects a point-in-time snapshot.

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

Similar skills

All skills for Browser and scraping →

From the same set96

scraping-youtube-channel-data Collects YouTube channel metrics and video catalogs through Apify. Use it to process channels in bulk from URLs or handles. CX Codex +1 733installs finding-digital-agencies-via-google-search Finds digital agencies and web studios in Google Search using Apify. Extracts company domains and snippets while scoring leads for B2B prospecting. CX Codex +1 730installs analyzing-tiktok-hashtag-performance Measures TikTok hashtag reach, engagement, top videos, and creators through Apify. Use it to compare tags or shape a hashtag plan for a post. CX Codex +1 730installs finding-youtube-channels-by-growth-rate Finds YouTube channels with high growth rates in a niche using Apify's YouTube scraper. Useful for spotting rising creators before they get big. CX Codex +1 730installs scraping-instagram-users-by-keyword Collects Instagram profiles from keywords, handles, and URLs, with optional follower and following lists. Useful for account data exports and research. CX Codex +1 729installs tracking-product-launch-buzz-on-twitter Tracks product launch tweets via an Apify scraper, categorizing public sentiment and calculating a buzz score. Handy for marketing teams monitoring releases. CX Codex +1 726installs finding-restaurant-brands-on-instagram Discovers restaurant profiles and food brands on Instagram using Apify. Extracts engagement metrics and scores leads for B2B prospecting. CX Codex +1 717installs scraping-urban-dictionary-definitions Extracts slang definitions, context examples, and user votes from Urban Dictionary. Useful for tracking internet culture and online trends. CX Codex +1 698installs

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