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

Extract information about YouTube videos by specific hashtags. Get video URL, caption, timestamp, likes, dislikes, views and comments count, and basic channel info. You can download your data in JSON, CSV, Excel, and more.

- **URL**: https://apify.com/streamers/youtube-video-scraper-by-hashtag.md
- **Developed by:** [Streamers](https://apify.com/streamers) (Apify)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 623 total users, 4 monthly users, 99.9% runs succeeded, 21 bookmarks
- **User rating**: 4.94 out of 5 stars

## Pricing

$2.00 / 1,000 videos

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

### What is YouTube Video Scraper by Hashtag?

YouTube Video Scraper by Hashtag is a powerful and easy-to-use tool that allows you to **extract data from YouTube videos that use a particular hashtag.** Using this YouTube hashtag extractor, you will be able to get data on:

<table>
<tr>
<td>📺Channel</td>
<td>📝Title</td>
</tr>
<tr>
<td>📅 Date</td>
<td>⏱️ Duration</td>
</tr>
<tr>
<td>🔗URL</td>
<td>👁️View count</td>
</tr>
</table>

### How to scrape YouTube with YouTube Video Scraper by Hashtag?

YouTube Video Scraper by Hashtag is designed to be user-friendly, even for those who have never extracted data from the web before! Here’s how you can use this YouTube Hashtag extractor to get the data you need:

1. [Create](https://console.apify.com/actors/89uTe0zmDUIatNKSd?addFromActorId=89uTe0zmDUIatNKSd) a free Apify account using your email.
2. Open [YouTube Video Scraper by Hashtag](https://apify.com/streamers/youtube-video-scraper-by-hashtag)
3. Add one or more YouTube hashtags to scrape data.
4. Click the “Start” button and wait for the data to be extracted.
5. Download your data in JSON, XML, CSV, Excel, or HTML.

### 🔼Input sample

To run this Actor, just put your desired hashtags in the input tab. For adding more hashtags at once, use the **Bulk edit** button. See example here:

You can also write the input in JSON:

```json
{
    "hashtags": ["ai"],
    "maxResults": 10,
    "scrapeShortsOnly": false
}
```

### 🔽Output sample

The scraped results will be shown as a dataset which you can find in the **Storage** tab. Note that the output is organized as a table for viewing convenience, but it doesn’t show **all the fields**:

You can preview all the fields and **download the file with the hashtag for YouTube video data in various formats** (JSON, CSV, Excel, and more).

Here’s a little JSON example:

```json
 {
    "thumbnailUrl": "<https://i.ytimg.com/vi/dRPNp7mcAMI/hqdefault.jpg?sqp=-oaymwE1CKgBEF5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AG2CIACgA-KAgwIABABGGUgVyhKMA8=&rs=AOn4CLAdl5PPEqaj0sSmXoQFkGvNsp8pOg>",
    "title": "ARE THEY ROBOTS OR REAL PEOPLE!!😳🤖 #shorts #ai #robot #scary #artificialintelligence",
    "id": "dRPNp7mcAMI",
    "url": "<https://www.youtube.com/watch?v=dRPNp7mcAMI>",
    "viewCount": 42015657,
    "type": "video",
    "hashtagCategoryData.categoryInfoText": "5.1M videos • 978K channels"
  },

```

### How can I use the data extracted from Youtube Video Scraper by Hashtag?

✨ Conducting sentiment analysis

👩‍🔬 Obtaining data for research and **social listening experiments**

🦠 **Analyzing trends,** and viral campaigns

🥸 **Identifying unverified content** and inaccurate information with high public value

📚 Preparing for or analyzing a **YouTube** **marketing campaign**

🧛 Doing lead generation research by looking for creators using these specific hashtags

### Integrate YouTube Video Scraper by Hashtag and automate your workflow

Last but not least, YouTube Video Scraper by Hashtag can be connected with almost any cloud service or web app thanks to [integrations](https://apify.com/integrations) on the Apify platform</a>.

These include:

- [Make](https://docs.apify.com/platform/integrations/make)
- [Zapier](https://docs.apify.com/platform/integrations/zapier)
- [Slack](https://docs.apify.com/platform/integrations/slack)
- [Airbyte](https://docs.apify.com/platform/integrations/airbyte)
- [GitHub](https://docs.apify.com/platform/integrations/github)
- [Google Drive](https://docs.apify.com/platform/integrations/drive)
- and [much more](https://docs.apify.com/platform/integrations).

Alternatively, you can use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to carry out an action whenever an event occurs, e.g. get a notification whenever YouTube Video Scraper by Hashtag successfully finishes a run.

### Scrape any YouTube data you need with dedicated scrapers

If you want to extract specific YouTube data, you can use one of the specialized scrapers below:

<table>
<tr>
<td>🔴<a href="[https://apify.com/streamers/youtube-scraper](https://apify.com/streamers/youtube-scraper)">YouTube Scraper</a></td>
<td>💬 <a href="[https://apify.com/streamers/youtube-comments-scraper](https://apify.com/streamers/youtube-comments-scraper)">YouTube Comments Scraper</a></td>
<td>🏎 <a href="[https://apify.com/streamers/youtube-channel-scraper](https://apify.com/streamers/youtube-channel-scraper)">Fast YouTube Channel Scraper</a></td>
<td>▶️ <a href="[https://apify.com/streamers/youtube-shorts-scraper](https://apify.com/streamers/youtube-shorts-scraper)">YouTube Shorts Scraper</a></td>
<td>⬇️<a href="[https://apify.com/pocesar/download-youtube-video](https://apify.com/pocesar/download-youtube-video)">YouTube Video Downloader</a></td>
</tr>
</table>

You can also combine YouTube data with that from other social networks. For example you can gather data with our [TikTok scrapers](https://apify.com/clockworks), [Instagram scrapers](https://apify.com/store/categories?search=instagram\&managedBy=APIFY), [Facebook scrapers](https://apify.com/store/categories?search=facebook\&managedBy=APIFY), and other [social media scrapers](https://apify.com/store?category=SOCIAL_MEDIA).

Furthermore, you can use the power of AI agents to do multiple tasks at one. For example, our [Comments Analyzer Agent](https://apify.com/apify/comments-analyzer-agent) can perform sentiment analysis of YouTube videos, or you could try our [Influencer Discovery Agent](https://apify.com/apify/influencer-discovery-agent) for lead generation on TikTok videos.

### Your feedback

We’re always working on improving the performance of our Actors. So if you’ve got any technical feedback for YouTube Video Scraper by Hashtag or simply found a bug, please create an issue on the Actor’s [Issues tab](https://apify.com/streamers/youtube-video-scraper-by-hashtag/issues/open) in Apify Console.

### Error items

When the scraper cannot retrieve data for a given input — for example no videos are found for a hashtag — it pushes an **error item** to the dataset instead of silently skipping it. Normal output items are never affected; you can tell them apart by the presence of an `error` field.

#### Error item structure

```json
{
    "url": "https://www.youtube.com/hashtag/somehashtag",
    "input": "somehashtag",
    "error": "NO_VIDEOS",
    "note": "No videos found on the page."
}
```

#### Error codes reference

| `error`                      | Meaning                                                             |
| ---------------------------- | ------------------------------------------------------------------- |
| `CHANNEL_DOES_NOT_EXIST`     | Channel URL points to a channel that does not exist                 |
| `NOT_FOUND`                  | Page was not found                                                  |
| `VIDEO_UNAVAILABLE`          | Video is not available (deleted, region-blocked, etc.)              |
| `AGE_RESTRICTED`             | Channel is age-restricted and cannot be accessed without login      |
| `CHANNEL_HAS_NO_VIDEOS`      | Channel exists but has no uploaded videos                           |
| `CHANNEL_HAS_NO_LIVE_VIDEOS` | Channel exists but has no live videos                               |
| `CHANNEL_HAS_NO_SHORTS`      | Channel exists but has no Shorts                                    |
| `DATE_FILTER_TOO_STRICT`     | Videos exist but none match the active date filter                  |
| `NO_VIDEOS`                  | No videos found on the page                                         |
| `NO_RESULTS`                 | No results collected — check that video-type limits are set above 0 |
| `NO_VALID_START_URLS`        | All provided start URLs were invalid or malformed                   |
| `INVALID_INPUT`              | Actor failed due to bad configuration (run is also terminated)      |
| `NO_COMMENTS`                | No comments found for the video                                     |

***

### ❓FAQ

#### How much does it cost to use YouTube Video Scraper by Hashtag?

YouTube Video Scraper by Hashtag uses the Pay-per-result pricing model, so your costs can be easily calculated: it will cost you **$2 to scrape 1,000 results**, so $0.002 per item. Apify provides you with $5 free usage credits every month on the [Apify Free plan](https://apify.com/pricing), so you can **get 2,500 results from YouTube Video Scraper by Hashtag for free**.

But if you need to extract data regularly, you should get an Apify subscription. We recommend our $29/month Starter plan — that one could get you **over 14,500 results from YouTube Video Scraper by Hashtag** every month.

#### How can I use YouTube Video Scraper by Hashtag with the Apify API?

The Apify API gives you programmatic access to the Apify platform. The API is organized around RESTful HTTP endpoints that enable you to manage, schedule and run Apify actors. The API also lets you access any datasets, monitor actor performance, fetch results, create and update versions, and more.

You can use the `apify-client` NPM package to access the API using Node.js, or the `apify-client PyPI` package to access the API using Python.

Check out the [Apify API reference](https://docs.apify.com/api/v2) docs for full details or click on the [API tab](https://apify.com/streamers/youtube-video-scraper-by-hashtag/api/client/nodejs) for code examples.

#### Can I use YouTube Scraper through an MCP Server?

With Apify API, you can use almost any Actor in conjunction with an MCP server. You can connect to the MCP server using clients like ClaudeDesktop and LibreChat, or even build your own. Read all about how you can [set up Apify Actors with MCP](https://blog.apify.com/how-to-use-mcp/).

For YouTube Scraper, go to the [MCP tab](https://apify.com/streamers/youtube-video-scraper-by-hashtag/api/mcp) and then go through the following steps:

1. Start a Server-Sent Events (SSE) session to receive a `sessionId`
2. Send API messages using that `sessionId` to trigger the scraper
3. The message starts the Amazon ASINs Scraper with the provided input
4. The response should be: `Accepted`

#### Is it legal to scrape YouTube data with YouTube Video Scraper by Hashtag?

Our [YouTube scrapers](https://apify.com/store/categories?search=youtube), YouTube Video Scraper by Hashtag included, are ethical and **do not extract any private user data, such as email addresses, gender, or location**. They can only extract what the user has chosen to share publicly. However, you should be aware that your results might contain personal data.

Personal data is protected by GDPR in the European Union and other laws and regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you’re unsure whether your reason is legitimate, consult your lawyers. You can also read our blog post on the [legality of web scraping](https://blog.apify.com/is-web-scraping-legal/) and [ethical scraping](https://blog.apify.com/what-is-ethical-web-scraping-and-how-do-you-do-it/).

# Changelog

This Actor's version history is a separate document: https://apify.com/streamers/youtube-video-scraper-by-hashtag/changelog.md

# Actor input Schema

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

Hashtags to scrape

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

Limit the number of videos you want to crawl from per hashtag.

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

Whether to scrape all videos or shorts only. `Disabled(default)=all videos`, `Enabled=shorts`. https://www.youtube.com/hashtag/apify vs https://www.youtube.com/hashtag/apify/shorts

## Actor input object example

```json
{
  "hashtags": [
    "gaming",
    "tutorial"
  ],
  "maxResults": 50,
  "scrapeShortsOnly": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing YouTube videos filtered by hashtag

# 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": [
        "apify"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("streamers/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": ["apify"],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("streamers/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": [
    "apify"
  ],
  "maxResults": 10
}' |
apify call streamers/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,streamers/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/89uTe0zmDUIatNKSd/builds/3ERadgkMc5CyETJfl/openapi.json
