Youtube Scraper avatar
Youtube Scraper
Under maintenance

Pricing

Pay per usage

Go to Apify Store
Youtube Scraper

Youtube Scraper

Under maintenance

A powerful Apify Actor that scrapes YouTube videos from channels, playlists, or search results without using the official YouTube API. Built with Python and the scrapetube library.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Ayush Goyal

Ayush Goyal

Maintained by Community

Actor stats

0

Bookmarked

3

Total users

1

Monthly active users

21 days ago

Last modified

Share

YouTube Scraper Actor

A powerful Apify Actor that scrapes YouTube videos from channels, playlists, or search results without using the official YouTube API. Built with Python and the scrapetube library.

Features

  • Channel Scraping: Get videos from any YouTube channel

    • Support for channel ID, URL, or username
    • Filter by content type (videos, shorts, streams)
    • Sort by newest, oldest, or popular
  • Playlist Scraping: Extract all videos from any playlist

  • Search Scraping: Search YouTube and get results

    • Filter by result type (video, channel, playlist, movie)
    • Sort by relevance, upload date, view count, or rating
  • No API Key Required: Uses scrapetube to scrape data without YouTube API limitations

  • Proxy Support: Optional proxy configuration to avoid blocking

  • Structured Output: Clean, normalized data with thumbnails, view counts, and more

Input Parameters

Required

  • scrapeType (string): Choose what to scrape - channel, playlist, or search

Channel Scraping

  • channelId (string): YouTube channel ID (e.g., UCXuqSBlHAE6Xw-yeJA0Tunw)
  • channelUrl (string): Full channel URL (alternative to channel ID)
  • channelUsername (string): Channel username without @ (alternative to channel ID)
  • contentType (string): Type of content - videos, shorts, or streams (default: videos)
  • sortBy (string): newest, oldest, or popular (default: newest)

Playlist Scraping

  • playlistId (string): YouTube playlist ID

Search Scraping

  • searchQuery (string): Search term to find videos
  • resultsType (string): video, channel, playlist, or movie (default: video)
  • sortBy (string): relevance, upload_date, view_count, or rating (default: relevance)

Common Parameters

  • maxVideos (integer): Maximum number of videos to scrape (default: 100)
  • sleepInterval (number): Seconds to sleep between requests to prevent blocking (default: 1)
  • proxyUrls (array): Optional proxy URLs in format http://username:password@host:port

Output

The actor outputs structured data for each video including:

  • videoId: YouTube video ID
  • title: Video title
  • url: Full YouTube URL
  • channelName: Channel name
  • channelId: Channel ID
  • viewCount: Number of views
  • publishedTime: When the video was published
  • lengthText: Video duration
  • thumbnailUrl: Video thumbnail image URL
  • descriptionSnippet: Short description excerpt
  • rawData: Complete raw data from scrapetube

Example Usage

Scrape Latest Videos from a Channel

{
"scrapeType": "channel",
"channelUsername": "LinusTechTips",
"contentType": "videos",
"sortBy": "newest",
"maxVideos": 50
}

Search YouTube

{
"scrapeType": "search",
"searchQuery": "python tutorial",
"resultsType": "video",
"sortBy": "view_count",
"maxVideos": 100
}

Scrape a Playlist

{
"scrapeType": "playlist",
"playlistId": "PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf",
"maxVideos": 200
}

Local Development

Prerequisites

  • Python 3.11+
  • Apify CLI

Install Apify CLI

Windows:

irm https://apify.com/install-cli.ps1 | iex

macOS/Linux:

$curl -fsSL https://apify.com/install-cli.sh | bash

Setup and Run

  1. Install dependencies:
$pip install -r requirements.txt
  1. Create a local input file .actor/INPUT.json:
{
"scrapeType": "search",
"searchQuery": "apify tutorial",
"maxVideos": 10
}
  1. Run locally:
$apify run

Deploy to Apify Platform

  1. Login to Apify:
$apify login
  1. Push the actor:
$apify push

Technical Details

  • Runtime: Python 3.11
  • Base Image: apify/actor-python:3.11
  • Main Libraries:
    • apify - Apify SDK for Python
    • scrapetube - YouTube scraping library

Notes

  • The actor respects YouTube's structure and implements rate limiting via sleepInterval
  • No authentication or API key required
  • Data extraction is based on YouTube's public HTML structure
  • Some fields may be unavailable depending on the video/channel

Contributing

This actor was generated as part of the Apify AI Challenge. Feel free to submit improvements!

License

ISC

Support

For issues or questions, please open an issue on the GitHub repository.