Youtube Search avatar
Youtube Search

Pricing

$10.00/month + usage

Go to Store
Youtube Search

Youtube Search

Developed by

Maged Safwat

Maged Safwat

Maintained by Community

The YouTube Search Scraper is an Apify actor that extracts metadata from YouTube search results.

5.0 (1)

Pricing

$10.00/month + usage

0

Total users

2

Monthly users

2

Runs succeeded

>99%

Last modified

2 days ago

YouTube Search Scraper

Overview

The YouTube Search Scraper is an Apify actor that extracts metadata from YouTube search results. It retrieves video details such as title, video ID, uploader, duration, view count, and more, based on a search query, with flexible filters for Shorts, duration, upload date, and sorting. The actor uses Apify’s proxies to ensure reliable scraping and includes robust error handling, logging, and retry logic. It’s ideal for analyzing YouTube search trends and is accessible via Apify’s UI, CLI, or API in any programming language.

Features

  • Comprehensive Metadata: Extracts title, video ID, URL, uploader, uploader ID, upload date, duration, view count, thumbnail, and Shorts status.
  • Search Filters: Supports filtering by Shorts (shorts_only, exclude_shorts), duration (min_duration, max_duration), upload date (last_24h, last_week, last_month, last_year), and sorting (relevance, date, view_count, rating).
  • Proxy Support: Uses Apify’s proxies for reliable scraping.
  • Robust Execution: Includes detailed logging, 3-minute actor timeout, 90-second scrape timeout, and exponential backoff retries.
  • Output Formats: Data stored in Apify’s dataset, exportable as JSON or CSV, with a table view in Apify UI.
  • Cross-Language Access: Run via Apify’s REST API or SDKs (Python, Node.js, etc.) for integration with any language.

Input Configuration

The actor accepts a JSON input with the following fields:

FieldTypeDescriptionRequiredDefault
queryStringSearch query for YouTube videosYes-
max_resultsIntegerMaximum number of videos to scrape (1–100)No10
shorts_onlyBooleanOnly include Shorts in resultsNofalse
exclude_shortsBooleanExclude Shorts from resultsNofalse
min_durationIntegerMinimum video duration in secondsNo-
max_durationIntegerMaximum video duration in secondsNo-
upload_date_filterStringFilter by upload date (last_24h, last_week, last_month, last_year)No"" (Any)
sort_byStringSort results (relevance, date, view_count, rating)Norelevance
sleep_intervalIntegerSeconds to wait between requestsNo2
max_retriesIntegerMaximum retry attempts for failed requestsNo3

Notes:

  • shorts_only and exclude_shorts are mutually exclusive.
  • max_results is capped at 100 to avoid excessive runtime.
  • Increase sleep_interval or max_retries for heavy scraping or persistent errors.

Example Input:

{
"query": "python tutorial",
"max_results": 20,
"shorts_only": false,
"exclude_shorts": true,
"min_duration": 300,
"max_duration": 3600,
"upload_date_filter": "last_month",
"sort_by": "view_count",
"sleep_interval": 2,
"max_retries": 3
}

Output Format

The actor outputs data to Apify’s dataset, viewable as a table in the Apify UI or exportable as JSON/CSV. Each record contains:

FieldTypeDescriptionFormat
titleStringVideo titleText
video_idStringUnique video IDText
urlStringVideo URLText
uploaderStringUploader nameText
uploader_idStringUploader IDText
upload_dateStringUpload date (YYYYMMDD)Date
durationIntegerDuration in secondsNumber
view_countIntegerNumber of viewsNumber
thumbnailStringThumbnail URLText
shortBooleanIs the video a ShortBoolean
errorStringError message if scraping failedText

Example Output:

{
"title": "Python Tutorial for Beginners",
"video_id": "abc123",
"url": "https://www.youtube.com/watch?v=abc123",
"uploader": "TechTutorials",
"uploader_id": "UCxyz",
"upload_date": "20250101",
"duration": 1800,
"view_count": 100000,
"thumbnail": "https://i.ytimg.com/vi/abc123/hqdefault.jpg",
"short": false
}