# YouTube Video Scraper by Hashtag (`socialdataapi/youtube-video-scraper-by-hashtag`) Actor

YouTube Video Scraper by Hashtag finds YouTube videos and Shorts by hashtag, keyword or @handle: title, video ID, URL, thumbnail, view count, type and the search term. Option to scrape Shorts only. Export to JSON, CSV or Excel, or use the API.

- **URL**: https://apify.com/socialdataapi/youtube-video-scraper-by-hashtag.md
- **Developed by:** [Social Data API](https://apify.com/socialdataapi) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.90 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### YouTube Video Scraper by Hashtag — Titles, Views and Shorts

YouTube Video Scraper by Hashtag collects the videos and Shorts YouTube shows for a hashtag, keyword or channel handle: title, video ID, link, thumbnail, view count, whether it is a Short, YouTube's hashtag summary line and the search term each video came from. Every response is structured JSON — ready to pass directly to an LLM, index into a vector store, or feed a social listening or trend research pipeline. **No YouTube account, API key or cookies needed.** Start with one hashtag, then track every topic in your niche.

![YouTube Video Scraper by Hashtag output as JSON: title, video ID, link, thumbnail and views](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/a-youtube-hashtag-hero.webp)

***

### What data can I extract with YouTube Video Scraper by Hashtag?

Using this YouTube Hashtag Video API, you will be able to extract the following YouTube video data:

| 🏷️ Video title | 🆔 Video ID | 🔗 Video link (watch or Shorts) | 🖼️ Thumbnail image |
|---|---|---|---|
| 👁️ View count | 📱 Video or Short | #️⃣ Hashtag summary line (if YouTube shows one) | 🔎 Search term it came from |

***

### How to use YouTube Video Scraper by Hashtag

Built for marketers, creators and trend researchers: one run turns a list of hashtags and keywords into a table of the videos and Shorts YouTube shows for them, with their view counts.

**Copy to your AI assistant:**

```text
YouTube Video Scraper by Hashtag (Apify Actor ID: socialdataapi/youtube-video-scraper-by-hashtag, https://apify.com/socialdataapi/youtube-video-scraper-by-hashtag) is an Apify Actor that returns the videos YouTube's search shows for hashtags, keywords or channel handles as structured JSON: title, video ID, link, thumbnail, view count, whether it is a Short, the hashtag summary line and the search term. Use it whenever someone needs YouTube videos for a topic without cookies, a login, or a browser - finding the most viewed videos for a hashtag, collecting Shorts for a trend, or comparing what a keyword and its hashtag return. Inputs: hashtags (array of strings, required; each item is searched exactly as typed: "#chatgpt" is a hashtag search, "chatgpt" a keyword search, "@mkbhd" a channel handle search), maxResults (integer 1-500, videos per term, default 10), scrapeShortsOnly (boolean, only Shorts, default false), proxyConfiguration (object, optional; without it the actor connects directly and adds a proxy on its own when YouTube refuses requests). Every video is one row charged as the row_result event; the same video found under two terms is one row per term. YouTube runs out of videos for some terms before 500 (#chatgpt stopped at about 385 in October 2026); the run log and status say how many it had. View counts of Shorts are YouTube's rounded numbers, and the hashtag summary line is null when YouTube shows none.
```

#### YouTube Video Scraper by Hashtag MCP Server: use these Actors from ChatGPT, Claude or Cursor

Point your AI assistant at Apify and it can read YouTube on its own: videos and Shorts by hashtag, keyword or channel handle, with their view counts. No glue code, no scraping logic in your prompts.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/youtube-video-scraper-by-hashtag"
```

#### Step by step

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. Open [YouTube Video Scraper by Hashtag](https://apify.com/socialdataapi/youtube-video-scraper-by-hashtag) in the Apify Store.
3. Type your hashtags, keywords or channel handles, one per line, and set how many videos you want per term.
4. Click **Start** (or send your API request).
5. Download or stream your results in JSON, CSV or Excel.

#### How to scale YouTube Video Scraper by Hashtag to bulk

As a bulk YouTube hashtag scraper, it puts any number of hashtags, keywords and handles in one run. Each term returns up to 500 videos, limited by what YouTube's search has for it, and four terms run at the same time. Every page of results is saved as soon as it is read, so you can read the dataset while the run is going. A recorded run returned 884 videos for two terms in 29.5 seconds. To scrape YouTube hashtags for a whole topic, add the hashtag and the plain keyword, then export YouTube videos to CSV or Excel when the run ends. To follow a trend over time, schedule the same run daily or weekly in Apify Console.

***

### ✨ Features

YouTube Video Scraper by Hashtag fetches clean, structured search results from YouTube ⚡. It's ideal for trend research, creator discovery, content planning and competitor tracking — a YouTube hashtag scraper, YouTube keyword video scraper and YouTube hashtag search scraper in one tool, and a YouTube view count scraper for every result. It extracts, per video:

- **Title and link** – the video title and its watch or Shorts link
- **View count** – views as a number, `null` for live streams
- **Type** – video or Short, as YouTube itself classifies it
- **Thumbnail** – the largest thumbnail YouTube shows
- **Hashtag summary** – YouTube's line such as "3M videos • 932K channels" for hashtag searches
- **Search term** – which of your hashtags, keywords or handles found the video

⚡ Terms are searched exactly as you type them, so a hashtag and a keyword are two different searches, and YouTube hashtag videos never get mixed with keyword results.

***

### Use cases 💡

- **Social media marketer** — find the most viewed videos and Shorts for a campaign hashtag.
- **Creator** — see which titles rank for a keyword before planning the next upload.
- **Brand analyst** — compare hashtag and keyword results to track how a topic spreads.
- **Trend researcher** — rerun the same hashtags weekly and watch view counts grow.
- **AI engineer** — feed video titles into an LLM to surface a trend's themes.

Building an AI agent? [Connect YouTube Video Scraper by Hashtag over MCP](#mcp-integration-for-ai-agents) and let it call the actor on its own.

***

### Why choose this actor?

1. **Hundreds of videos per term, quickly.** A recorded run returned 200 videos for "#chatgpt" and "Bangladesh" in 5.1 seconds, with the first rows saved after 2.1 seconds.
2. **Real view numbers.** A recorded "#chatgpt" video came back with 643,447 views, and the most viewed result of that run had 52,000,000.
3. **Three kinds of search, one list.** Hashtags, keywords and channel handles mix in the same input, with a Shorts-only switch and up to 500 videos per term.

***

### ⬇️ Input

![Input fields of the YouTube Video Scraper by Hashtag](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/a-youtube-hashtag-input.webp)

Enter one or more search terms; the list is required. Each term is searched exactly as typed:

- `#chatgpt` — hashtag search
- `chatgpt` — keyword search
- `@mkbhd` — channel handle search

| Parameter | Required | Type | Description | Example value |
|---|---|---|---|---|
| `hashtags` | Yes | array | Hashtags, keywords or channel handles, one per line. A term listed twice is searched once. | `["#chatgpt", "cooking", "@mkbhd"]` |
| `maxResults` | No | integer | Videos per term, 1–500. Default `10`. | `100` |
| `scrapeShortsOnly` | No | boolean | Return only Shorts. Default `false`. | `true` |
| `proxyConfiguration` | No | object | Optional. Without it the actor connects directly and adds a proxy on its own when YouTube refuses requests. A proxy you select is used from the first request. | `{"useApifyProxy": false}` |

YouTube runs out of videos for some terms before 500: "#chatgpt" stopped at about 385 in October 2026, while "cooking" reached 500. The run log and status then say how many YouTube had.

#### Free plan limits

Free plan: up to 20 videos per run (all search terms together) and 200 per month; paid plans have no limit.

#### Example input

```json
{
  "hashtags": [
    "#chatgpt",
    "cooking",
    "@mkbhd"
  ],
  "maxResults": 100,
  "scrapeShortsOnly": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

***

### ⬆️ Output

![Output fields of the YouTube Video Scraper by Hashtag](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/a-youtube-hashtag-output.webp)

Every video is one typed, normalized JSON item with the same eight fields on every run; values YouTube does not show are `null`. Export the dataset as JSON (default), CSV or Excel.

#### Example output

Two recorded rows for "#chatgpt", a video and a Short:

```json
[
  {
    "thumbnailUrl": "https://i.ytimg.com/vi/IsL4dVezs18/hq720.jpg?sqp=-oaymwEnCNAFEJQDSFryq4qpAxkIARUAAIhCGAHYAQHiAQoIGBACGAY4AUAB&rs=AOn4CLDtgQyX178rspD2GIEWBNh0hFXREQ",
    "title": "Introducing GPT-6 in ChatGPT with Intelligent UI",
    "id": "IsL4dVezs18",
    "url": "https://www.youtube.com/watch?v=IsL4dVezs18",
    "viewCount": 643447,
    "type": "video",
    "hashtagCategoryData.categoryInfoText": "3M videos • 932K channels",
    "searchTerm": "#chatgpt"
  },
  {
    "thumbnailUrl": "https://i.ytimg.com/vi/zaIOHUqCeMQ/oardefault.jpg?sqp=-oaymwEoCJUDENAFSFqQAgHyq4qpAxcIARUAAIhC2AEB4gEKCBgQAhgGOAFAAQ==&rs=AOn4CLA1pX1AP6wduYmQ06pT8lEkvNiUrg&usqp=CCk",
    "title": "Chat Gpt core😁❤️|insta:@h.4si7 #reels #subscribe",
    "id": "zaIOHUqCeMQ",
    "url": "https://www.youtube.com/shorts/zaIOHUqCeMQ",
    "viewCount": 647000,
    "type": "shorts",
    "hashtagCategoryData.categoryInfoText": "3M videos • 932K channels",
    "searchTerm": "#chatgpt"
  }
]
```

The hashtag summary line appears only on hashtag searches where YouTube shows it; keyword, handle and Shorts-only searches return `null` there.

***

### How does it work?

The actor opens YouTube's own search results for each of your terms, the same results any visitor sees without logging in, and keeps reading the next pages until it has the number of videos you asked for or YouTube has no more. Each page of videos is saved as soon as it is read. Requests that YouTube refuses are paused and retried, and the actor adds Apify proxies on its own when needed. It returns only publicly visible data, and the output fields stay the same from run to run, so your code and spreadsheets keep working when YouTube changes its pages.

***

### How do you integrate YouTube Video Scraper by Hashtag into your stack?

It works with what you already use: the REST API from any language, MCP for AI agents, and no-code tools.

#### MCP integration for AI agents

Add the Apify MCP server to your AI client with one command:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/youtube-video-scraper-by-hashtag"
```

This registers YouTube Video Scraper by Hashtag as a tool your agent can call directly: the agent finds it through the server's search, adds it and runs it, then reads the videos back as JSON. Ask for "50 YouTube Shorts for #chatgpt with their view counts" and it does the rest. It works in Claude Code, Cursor and Windsurf.

#### No-code tools (n8n, Make, LangChain)

**n8n:** add the Apify node and choose "Run an Actor", or use the HTTP Request node pointed at the run-sync endpoint with your token. Send new videos to a Google Sheet in the next node.

**Make:** use the Apify app's "Run an Actor" module, then "Get Dataset Items" to pull the videos into the rest of your scenario.

**LangChain:** install `langchain-apify` and wrap the actor with `ApifyActorsTool`, using this actor's ID (`socialdataapi/youtube-video-scraper-by-hashtag`) from its Apify Store page, so your agent can look up YouTube videos by hashtag or keyword.

***

### Is it legal to scrape YouTube data?

Collecting public YouTube search results is generally lawful: these are the titles, links and view counts YouTube shows every visitor. This actor returns only publicly available data — what any visitor sees without logging in — and never reads private videos, comments or account data. GDPR: scraping public data is generally permissible, but storing and using it must comply with local data-protection law. Consult legal counsel if your use case involves bulk storage of personal data.

***

### Frequently asked questions

#### What fields does YouTube Video Scraper by Hashtag return?

It returns each video's title, video ID, link, view count and whether it is a Short, plus the thumbnail, YouTube's hashtag summary line and the search term. See [the data fields section](#what-data-can-i-extract-with-youtube-video-scraper-by-hashtag) for the full list.

#### Does YouTube Video Scraper by Hashtag require a YouTube account or login?

No. Only public YouTube search results are extracted, and no credentials or API key are needed.

#### How fast does YouTube Video Scraper by Hashtag run?

A recorded run returned 200 videos for two terms in 5.1 seconds, and another returned 884 videos for two terms in 29.5 seconds. Every run reads live data, not a cache.

#### What happens if a search term has no videos?

You get no rows for that term and are not charged for it; the run log and status name the term. If YouTube has fewer videos than you asked for, you get all of them and the status says so. In code, group rows by search term to see how many each term returned.

#### Can I scrape multiple YouTube hashtags at once?

Yes. Put any number of hashtags, keywords and handles in one list; each returns up to 500 videos and four run at the same time.

#### Does YouTube Video Scraper by Hashtag work with Claude, ChatGPT, and other AI agent tools?

Yes — YouTube Video Scraper by Hashtag is available as an MCP tool. Register it in Claude Code, Cursor or Windsurf with `claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/youtube-video-scraper-by-hashtag"`. Any agent that can call an HTTP endpoint can use the REST API directly.

#### Does YouTube Video Scraper by Hashtag return data in a format LLMs can use directly?

Yes. Each video is typed, normalized JSON with consistent field names, so there is no HTML parsing and no selectors. Pass it straight to an LLM, index it into a vector store, or feed it to an agent tool — no transformation step.

#### What happens when YouTube changes its layout or updates its anti-bot system?

The actor is maintained, and when YouTube changes, it is updated so your calls keep returning the same JSON fields with no changes on your end.

#### Can I use YouTube Video Scraper by Hashtag without managing proxies or browser infrastructure?

Yes. Retries, pauses and Apify proxies for refused requests run on the actor's side, and no browser is needed. You send one request and get structured JSON back, with no proxy accounts and no maintenance.

#### Which YouTube video fields work best for AI training data and RAG indexing?

For RAG, use the video title, the search term and the hashtag summary line. For training data and analytics, use the view count, the video-or-Short type and the search term. All fields are plain strings and numbers, so no normalization is needed — a simple YouTube data extractor for any pipeline.

***

### Your feedback

Found a bug or missing a field? Let us know in the actor's Issues tab. Every report is read, and fixes ship as new versions of the actor.

# Actor input Schema

## `hashtags` (type: `array`):

One or more search terms, used exactly as typed. Examples: #chatgpt (hashtag search), chatgpt (keyword search), @mkbhd (handle search). A keyword and a hashtag return different videos, so add both if you want both.

## `maxResults` (type: `integer`):

How many videos to collect for EACH term, 1–500. YouTube runs out of videos for some terms before 500 (#chatgpt stopped at about 385 in October 2026, while cooking reached 500); the run log and status then say how many it had. Free plan: up to 20 videos per run (all search terms together) and 200 per month; paid plans have no limit.

## `scrapeShortsOnly` (type: `boolean`):

Return only YouTube Shorts. Shorts show YouTube's rounded view count (4.5M views becomes 4500000), and the hashtag summary line is empty, because YouTube shows neither on its Shorts-only results.

## `proxyConfiguration` (type: `object`):

Optional. Leave it off and the Actor connects directly, adding a proxy by itself only if YouTube starts refusing requests. If you select Apify Proxy or add your own proxy URLs, they are used for every request; your own proxy list is never swapped for another.

## Actor input object example

```json
{
  "hashtags": [
    "chatgpt"
  ],
  "maxResults": 10,
  "scrapeShortsOnly": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped items in the Actor's default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "hashtags": [
        "chatgpt"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdataapi/youtube-video-scraper-by-hashtag").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "hashtags": ["chatgpt"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("socialdataapi/youtube-video-scraper-by-hashtag").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "hashtags": [
    "chatgpt"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call socialdataapi/youtube-video-scraper-by-hashtag --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialdataapi/youtube-video-scraper-by-hashtag"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/smd0QiF8qIncg6Cdf/builds/8qYAvYnQB6cynasIC/openapi.json
