Youtube Scraper avatar
Youtube Scraper

Pricing

$7.00/month + usage

Go to Apify Store
Youtube Scraper

Youtube Scraper

This Python script scrapes YouTube search results using yt-dlp. It fetches the top 20 videos for a given query, extracts video and channel details (title, views, duration, publish time, thumbnails), formats the data, saves it as a JSON file

Pricing

$7.00/month + usage

Rating

0.0

(0)

Developer

Data Pilot

Data Pilot

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Share

YouTube Search Scraper

A powerful Apify Actor that searches YouTube and extracts detailed video metadata including titles, views, duration, thumbnails, channel information, and more. Uses yt-dlp for reliable data extraction.

🎯 Features

  • 🔍 YouTube Search - Search for any keyword or phrase
  • 📹 Detailed Video Data - Title, URL, thumbnail, description, views, duration
  • 👤 Channel Information - Channel name, ID, URL
  • 📊 Formatted Metrics - Human-readable view counts and durations
  • ⏱️ Publish Dates - "X days/weeks/months ago" format
  • 🔄 Batch Results - Get up to 50 search results
  • 🌐 Proxy Support - Optional Apify Proxy
  • 💾 Dual Output - Complete results + individual videos

📥 Input

{
"searchQuery": "minecraft",
"maxResults": 20,
"useApifyProxy": true
}

Input Parameters

ParameterTypeRequiredDefaultDescription
searchQueryStringYes-YouTube search term
maxResultsIntegerNo20Number of results (1-50)
useApifyProxyBooleanNofalseEnable Apify Proxy
apifyProxyGroupsArrayNo["RESIDENTIAL"]Proxy pool type

Input Examples

Simple Search:

{
"searchQuery": "cooking recipes"
}

Custom Results:

{
"searchQuery": "python tutorial",
"maxResults": 50
}

With Proxy:

{
"searchQuery": "music playlist",
"maxResults": 30,
"useApifyProxy": true
}

📤 Output

The actor outputs two types of records:

1. Complete Search Results

{
"query": "minecraft",
"timestamp": "2026-01-18T05:30:00.000Z",
"totalResults": 20,
"video": [
{
"videoId": "dQw4w9WgXcQ",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"title": "Minecraft Survival Guide",
"thumbnail": "https://i.ytimg.com/vi/...",
"description": "Complete beginner's guide to Minecraft...",
"channelName": "Gaming Channel",
"channelId": "UCxxxxx",
"isChannelVerified": false,
"publishedTime": "2 weeks ago",
"viewH": "1.2M views",
"view": 1234567,
"durationH": "15 minutes, 30 seconds",
"duration": 930
}
],
"channel": [
{
"channelId": "UCxxxxx",
"url": "https://www.youtube.com/channel/UCxxxxx",
"channelName": "Gaming Channel",
"username": "gamingchannel",
"avatar": "",
"isChannelVerified": false,
"subscriberH": "N/A",
"description": "Channel by Gaming Channel"
}
]
}

2. Individual Video Records

{
"_type": "video",
"videoId": "dQw4w9WgXcQ",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"title": "Minecraft Survival Guide",
"thumbnail": "https://i.ytimg.com/vi/...",
"description": "Complete beginner's guide...",
"channelName": "Gaming Channel",
"channelId": "UCxxxxx",
"viewH": "1.2M views",
"view": 1234567,
"durationH": "15 minutes, 30 seconds",
"duration": 930,
"publishedTime": "2 weeks ago"
}

🚀 Usage

On Apify Platform

  1. Go to Actor page
  2. Click "Try for free" or "Start"
  3. Enter search query
  4. Set max results (optional)
  5. Click "Start"
  6. Download results from Dataset

🛠️ How It Works

  1. Input Processing - Validates search query
  2. yt-dlp Search - Executes YouTube search via yt-dlp
  3. Data Extraction - Extracts video and channel metadata
  4. Formatting - Converts views, duration, dates to readable format
  5. Output - Pushes complete results + individual videos to dataset

📝 Use Cases

  1. Content Research - Find popular videos on topics
  2. Competitor Analysis - Track competitor video performance
  3. Trend Analysis - Discover trending content
  4. Data Collection - Build video datasets
  5. SEO Research - Analyze video titles and descriptions
  6. Channel Discovery - Find channels in your niche

📊 Output Data Fields

Video Fields

  • videoId - YouTube video ID
  • url - Direct video URL
  • title - Video title
  • thumbnail - Highest quality thumbnail URL
  • description - Video description (truncated)
  • channelName - Channel/creator name
  • channelId - YouTube channel ID
  • viewH - Human-readable view count (e.g., "1.2M views")
  • view - Raw view count number
  • durationH - Human-readable duration
  • duration - Duration in seconds
  • publishedTime - Relative time (e.g., "2 weeks ago")

Channel Fields

  • channelId - YouTube channel ID
  • url - Channel URL
  • channelName - Channel name
  • username - Channel username/handle
  • description - Channel description

💡 Tips for Best Results

  1. Specific Queries: Use specific search terms for better results
  2. Result Limit: Start with 20 results, increase if needed
  3. Proxy: Enable for large batches or if blocked
  4. Data Access: Filter by _type: "video" for individual videos
  5. Rate Limiting: Add delays between multiple actor runs