Youtube Scraper avatar

Youtube Scraper

Pricing

from $2.00 / 1,000 scraped-results

Go to Apify Store
Youtube Scraper

Youtube Scraper

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

Pricing

from $2.00 / 1,000 scraped-results

Rating

0.0

(0)

Developer

Data Pilot

Data Pilot

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Categories

Features

Limited permissions

Share

▶️ YouTube Scraper is a powerful Apify Actor designed to collect video information from YouTube search results or from a single video link. This YouTube Scraper provides output including video title, URL, video ID, channel name and ID, channel link, view count, duration, description, and thumbnail for every video it finds. Whether you're researching a topic, tracking competitor content, or building a video dataset, the YouTube Scraper delivers structured video data efficiently.

With keyword search, direct video URL support, a configurable result limit, optional residential proxy, and reliable Apify Dataset delivery, this YouTube Scraper actor gives you a clean record for every video. It uses the open-source yt-dlp library for metadata extraction and never downloads the videos themselves, making YouTube Scraper a lightweight tool for YouTube research.


📋 Table of Contents


🔥 Features

  • Keyword Search – Enter a search phrase and the YouTube Scraper returns the matching videos. This is the core of YouTube Scraper.
  • Direct Video URL Support – Paste a video link (youtube.com/watch?v=, youtu.be, Shorts, or embed links) to get that video's details.
  • Video Metadata – Title, URL, ID, channel details, views, duration, description, and thumbnail.
  • Search Position – Each record includes its position in the results.
  • No Video Downloads – Only metadata is collected. No video or audio files are downloaded.
  • Configurable Result Limit – Control how many search results to collect with maxResults.
  • Optional Apify Proxy – Turn on Apify Proxy (residential by default) for more reliable YouTube Scraper access.
  • Failure Record – If a run fails, a record with the error message is saved instead of failing silently.
  • Pay-Per-Event Billing – Each saved result is one billable event, with a free allowance (see Pricing & Free Usage).
  • Detailed Logging – Logs progress and billing status for every YouTube Scraper run.

📊 Data Source

YouTube (via yt-dlp)

  • Source: YouTube search results and YouTube video pages
  • Access Method: The open-source yt-dlp library in metadata-only mode (no downloads), using its quick listing mode
  • Coverage: Public YouTube videos
  • Data: Video and channel metadata as exposed by yt-dlp
  • Access: No login or API key used
  • Update Frequency: Reflects YouTube at time of run

This Actor is not affiliated with or endorsed by YouTube or Google.


⚙️ How It Works

The YouTube Scraper accepts one search phrase or one video URL. If the input looks like a video link, it fetches that video. Otherwise it runs a YouTube search for the phrase and collects up to maxResults videos. Each video is saved to the Apify Dataset and counted as one billable result.

Key Processing Steps:

  1. Input Parsing – Read searchQuery and maxResults
  2. Proxy Setup – Configure Apify Proxy if useApifyProxy is on
  3. Input Routing – Treat the input as a direct video link if it matches a YouTube video URL, otherwise as a search phrase
  4. Metadata Extraction – Use yt-dlp to collect video details
  5. Record Building – Create one record per video
  6. Save & Bill – Push each record to the Dataset and register one result-scrape event
  7. Limit Checks – Stop at the free limit or at the user's spending limit when they apply
  8. Summary Logging – Report the number of videos processed and charged

📥 Input

FieldTypeDefaultDescription
searchQuerystring"minecraft"A search phrase, or a single YouTube video URL.
maxResultsinteger20Number of search results to collect. Not used for a direct video URL.
useApifyProxybooleanfalseRoute requests through Apify Proxy.
apifyProxyGroupsarray["RESIDENTIAL"]Apify Proxy groups to use when useApifyProxy is on.

Example Input (search):

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

Example Input (single video):

{
"searchQuery": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}

With Residential Proxy:

{
"searchQuery": "web scraping",
"maxResults": 30,
"useApifyProxy": true,
"apifyProxyGroups": ["RESIDENTIAL"]
}

📤 Output

One YouTube Scraper record is pushed per video:

FieldTypeDescription
searchQuerystringThe search phrase or URL you entered
positionintegerPosition of the video in the results (1 for a direct URL)
idstringYouTube video ID
titlestringVideo title
urlstringVideo link
channelNamestringChannel name
channelIdstringChannel ID
channelUrlstringChannel link
viewsinteger or nullView count
durationnumber or nullDuration in seconds
descriptionstring or nullVideo description
thumbnailstringThumbnail image URL
scrapedAtstringISO 8601 UTC timestamp

Example YouTube Scraper Record:

{
"searchQuery": "python tutorial",
"position": 1,
"id": "abc123XYZ_-",
"title": "Python Tutorial for Beginners",
"url": "https://www.youtube.com/watch?v=abc123XYZ_-",
"channelName": "Example Channel",
"channelId": "UCxxxxxxxxxxxxxxxxxxxxxx",
"channelUrl": "https://www.youtube.com/channel/UCxxxxxxxxxxxxxxxxxxxxxx",
"views": 1250000,
"duration": 3600,
"description": null,
"thumbnail": "https://i.ytimg.com/vi/abc123XYZ_-/hqdefault.jpg",
"scrapedAt": "2026-10-30T09:00:00+00:00"
}

If a run fails, the Dataset contains one record like this instead:

{
"searchQuery": "python tutorial",
"status": "failed",
"error": "<error message>"
}

🧰 Technical Stack

  • Extraction: yt-dlp in metadata-only mode (skip_download), using its quick listing mode and the android and web player clients
  • Async: asyncio with executor-run blocking extraction
  • Proxy: Apify Proxy, optional, residential by default
  • Billing: Apify pay-per-event charging (result-scrape event)
  • Logging: Apify Actor logging system
  • Platform: Apify Actor serverless environment

📊 Data Fields Explained

Video

  • id / title / url / thumbnail / description / duration / views: The video and its basic stats

Channel

  • channelName / channelId / channelUrl: The channel that published the video

Context

  • searchQuery / position / scrapedAt: What you searched for, where the video ranked, and when it was collected

🎯 Use Cases

  • Topic Research – See which videos rank for a keyword with the YouTube Scraper
  • Competitor Monitoring – Track videos published around a topic or brand
  • Content Ideas – Study titles, views, and durations of popular videos
  • Channel Discovery – Find channels that publish about a subject
  • Dataset Building – Collect video metadata for analysis and machine learning
  • Link Enrichment – Turn a list of video URLs into titles, channels, and stats (one URL per run)

🚀 Quick Start

1. Prepare Input

Go to Apify Console and enter:

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

2. Run the Actor

Click Start. The YouTube Scraper will:

  • Search YouTube or fetch your video link
  • Save each video to the Dataset
  • Register one billable event per result

3. Monitor Progress

Console shows:

🔎 Processing YouTube target: 'python tutorial'
🌐 Running with direct connection.
👤 User Tier Detected: ...
🎉 Complete! Processed 20 video(s) (Total charged events: ...).

4. View & Download Results

  • Results Tab: All YouTube Scraper records
  • Export: JSON, CSV, Excel, or HTML
  • API Access: Available via the Apify API

⚙️ Configuration

Larger search with proxy:

{
"searchQuery": "machine learning",
"maxResults": 50,
"useApifyProxy": true
}

Single video details:

{
"searchQuery": "https://youtu.be/dQw4w9WgXcQ"
}

💳 Pricing & Free Usage

  • This Actor uses pay-per-event billing. Each saved video counts as one result-scrape event.
  • Free allowance: If events are not being charged on your account, a run is limited to 30 results. When the limit is reached, the Actor stops and logs a message suggesting an upgrade.
  • Paying users: No built-in result cap. The run stops if your own spending limit for the event is reached.
  • Check the Actor's pricing tab in Apify Console for current prices.

📈 Performance

Processing Speed

  • One search or video request per run, so results arrive within seconds to a minute
  • Records are saved and billed one at a time

Resource Usage

  • Memory: Low, since no browser and no video download
  • Network: Lightweight metadata requests
  • Proxy: Optional Apify Proxy (residential by default when enabled)

⚠️ Important Notes

  • YouTube Terms: Automated access to YouTube may be restricted by its Terms of Service. YouTube's official Data API is the sanctioned route for many use cases. Review the terms before using this Actor, especially commercially.
  • Public Data Only: The Actor collects only metadata of public videos and downloads no media
  • Copyright: Video titles, descriptions, and thumbnails belong to their owners. Use them responsibly.
  • Affiliation: Not affiliated with or endorsed by YouTube or Google
  • Legal: Not legal advice

Data Quality

  • One Input per Run: Each run handles one search phrase or one video URL. Run the Actor again for each additional input.
  • Videos Only: Only video links (watch, youtu.be, Shorts, embed) are recognized as direct links. Playlist and channel links are not supported and would be treated as plain search text.
  • Empty Fields: The Actor uses a quick listing mode, so some fields (for example description, view count, or channel details) can be empty, especially for search results. Empty fields are returned as null, not filled with placeholder values.
  • Result Count: YouTube may return fewer videos than maxResults.
  • Failures: If extraction fails, one record with status: "failed" and the error message is saved and the run ends. If nothing is found, no records are saved and a warning is logged.
  • Blocking: YouTube may rate-limit or block requests, especially from data-center IPs. Turning on residential proxy can help but is not a guarantee.
  • Freshness: Views and other stats reflect YouTube at the time of the run

Best Practices

  • Start with a small maxResults to check the output
  • Turn on useApifyProxy for larger or repeated runs
  • Use specific search phrases for more relevant results
  • Check important numbers on YouTube before publishing them

Terms of Use:

  • Use for legitimate research, analytics, and content discovery
  • Respect YouTube's Terms of Service and creators' rights
  • Do not use for spam, harassment, or unlawful data collection
  • Use data responsibly and in compliance with applicable laws

Disclaimer: YouTube Scraper is provided as-is for research purposes. It is not affiliated with or endorsed by YouTube or Google. Users are responsible for compliance with all applicable laws and the terms of the data source. This is not legal advice.


⚖️ YouTube Scraper Excellence

This Actor is optimized for YouTube Scraper use with:

  • ✅ Keyword search and direct video URL support
  • ✅ Video and channel metadata in one record
  • ✅ Metadata only, no video downloads
  • ✅ Optional residential proxy
  • ✅ Clear failure records
  • ✅ Production-ready code