Skip to content
Search/
CyberMax › Answers

How to export YouTube search results (and trending videos) with view counts

Updated 2026-12-01 · Data and API builders · by CyberMax

Short answer

Use the official YouTube Data API: search.list returns the ranked video IDs for a keyword and videos.list adds views, likes, comments and duration. Vidtrawl on Apify runs both with your own free API key for any list of keywords, with date, length, country and language filters, at $0.20 per 1,000 videos plus $0.001 per run.

  1. Create a free YouTube Data API key: Google Cloud Console, new project, enable YouTube Data API v3, Credentials, Create API key (about 3 minutes, no billing account).
  2. Open Vidtrawl on Apify and paste the key into the YouTube Data API key field.
  3. Add search terms, one per line, and choose Results per search (up to about 500).
  4. Optional: sort by date or views, set a published-after date, a length, a country or a minimum view count.
  5. Optional: add country codes under Trending to get the most-popular chart.
  6. Run and download CSV or Excel. For alerts, turn on Monitor mode, sort by upload date and schedule it daily.

Copy-paste code

Python (pip install apify-client)

import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("cybermax/youtube-search-scraper").call(run_input={"apiKey": os.environ["YOUTUBE_API_KEY"], "queries": ["web scraping tutorial"], "maxResultsPerQuery": 50})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row)

cURL (one call, rows come back as JSON)

curl -X POST "https://api.apify.com/v2/acts/cybermax~youtube-search-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"apiKey": "YOUR_YOUTUBE_API_KEY", "queries": ["web scraping tutorial"], "maxResultsPerQuery": 50}'

No code: n8n, Make or Zapier

n8n: HTTP Request node (or the Apify node, action "Run an Actor and get dataset")
Method:  POST
URL:     https://api.apify.com/v2/acts/cybermax~youtube-search-scraper/run-sync-get-dataset-items
Auth:    Header Auth  ->  Authorization: Bearer <your Apify token>
Body:    JSON  {"apiKey": "YOUR_YOUTUBE_API_KEY", "queries": ["web scraping tutorial"], "maxResultsPerQuery": 50}

Make:    Apify app -> "Run an Actor" (Actor: cybermax/youtube-search-scraper, wait for finish = yes) -> "Get Dataset Items"
Zapier:  Apify app -> action "Run Actor" (cybermax/youtube-search-scraper) -> "Fetch Dataset Items" -> your app

From an AI agent (MCP)

# Any MCP client (Claude Desktop, Claude Code, Cursor, VS Code): Apify's hosted MCP server
{
  "mcpServers": {
    "youtube-search-scraper": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.apify.com/?tools=cybermax/youtube-search-scraper",
               "--header", "Authorization: Bearer ${APIFY_TOKEN}"],
      "env": { "APIFY_TOKEN": "<your Apify token>" }
    }
  }
}
# The agent sees one tool, cybermax--youtube-search-scraper, with the Actor's input schema (pass your YouTube API key in apiKey).
Real run on Apify (12 Nov 2026: 2 searches + the US trending chart, 148 videos in 3.8 s, 204 API units)
search#titlechannellengthviewslikes
web scraping tutorial1Learn Web Scraping in 5 Minutes (NO PRIOR KNOWLEDGE)CodeHead4:53188,6106,852
web scraping tutorial3Python Web Scraping Tutorial: Complete Guide 2026Oxylabs8:019,442555
trending:US50The Elite: Army Rangers | Official Trailer | Paramount+Paramount Plus1:3146,317523

Source: Vidtrawl (Apify Actor cybermax/youtube-search-scraper) README, real Apify run on 12 Nov 2026

Run Vidtrawl on ApifyYouTube Data API quota costs (Google)

Why you need your own API key

YouTube's terms and its robots.txt do not allow scraping its pages, so the legitimate way to read video data in bulk is the official YouTube Data API. Google gives each project 10,000 free units a day and ties them to a key, which is why the key is yours and not ours.

The key is a secret input: it is stored encrypted on Apify, sent only to googleapis.com and never written to logs or results. You can restrict it to the YouTube Data API and revoke it at any time.

The quota to plan around

A search page of 50 results costs 100 API units, so the free 10,000 daily units cover about 100 pages, or 5,000 results a day. Trending charts cost 1 unit per 50 videos. If you need more, request a higher quota in Google Cloud Console or spread schedules over the day.

Search is fuzzy

YouTube's search returns loosely related videos when there are few exact matches. Put exact phrases in quotes and use a minimum view count to drop noise. Results can also differ a little from what a signed-in person sees on youtube.com.

Good to know

YouTube returns at most about 500 results per search.

The API has no Shorts-only switch; use the under-4-minutes length filter.

Gripeline icon

Gripeline: See what users hate about any app

$0.0001 per review + $0.003 per app summary

Tracking what people say about an app as well? Gripeline pulls App Store and Google Play reviews into the same kind of table.

Runs on your own Apify account, pay per result; failed results are not charged.

Questions

Is it free to try?

Run it with no key for a free demo of the output format. With a key, Apify's free plan includes $5 of monthly credit, enough for about 24,000 results, and Google's quota is free.

Can I get an alert for new videos about my brand?

Yes. Monitor mode with Sort by: Upload date returns only videos not delivered before; schedule it daily and connect Slack or email in Apify Integrations.

Does it return transcripts or comments?

No. It returns the comment count and whether captions exist.

Can an AI agent use it?

Yes. Apify's MCP server exposes it as cybermax--youtube-search-scraper.

Free: the Free API Starter Kit

Copy-paste calls for 4 APIs with free daily tiers (CVE priority, VIN recalls, US duty rates, email checks), then 5 short emails on KEV/EPSS, MCP and free data.

You get one email to confirm first. Then the kit, and 5 short emails over two weeks. One-click unsubscribe in every email; we never share your address.

Compare the options

App Store and Google Play review scrapers compared: price per 1,000 reviewsGripeline vs two review scrapers on Apify: live price per 1,000 reviews, both stores in one schema, complaint

Related answers

How to get all videos from a YouTube channel, with views, likes and commentsExport every video of a YouTube channel with views, likes, comments and duration through the official API. PytHow to get views, likes and comments for a list of YouTube videosCheck views, likes, comments and duration for hundreds of YouTube links or a whole playlist through the offici