# YouTube Hashtag Scraper (`crawlerbros/youtube-hashtag-scraper`) Actor

Scrape YouTube videos and Shorts by hashtag. Extract all videos tagged with specific hashtags including views, channel info, and metadata.

- **URL**: https://apify.com/crawlerbros/youtube-hashtag-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Social media, SEO tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## YouTube Hashtag Scraper

Scrape YouTube videos and Shorts by hashtag. Provide one or more hashtags and extract all tagged videos including title, channel info, view counts, publish time, duration, and more — without needing cookies or a browser.

### Features

- Scrape videos from any YouTube hashtag page (`youtube.com/hashtag/<tag>`)
- Supports both **regular videos** and **Shorts**
- Filter by content type: All, Videos only, or Shorts only
- Paginate through all available results up to your configured limit
- Multi-market support (US, UK, Germany, India, Japan, Brazil, France, Spain, South Korea, Russia)
- HTTP-only approach — no browser overhead, fast and cost-efficient
- Clean output with no null fields

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `hashtags` | string[] | *(required)* | Hashtags to scrape. Include or omit the `#` prefix (e.g. `#programming` or `programming`). |
| `maxResultsPerHashtag` | integer | `50` | Maximum videos to return per hashtag (1–500). |
| `contentType` | string | `all` | Content to collect: `all`, `videos` (regular only), or `shorts` (Shorts only). |
| `market` | string | `US` | Country/region for localized results: `US`, `GB`, `DE`, `IN`, `JP`, `BR`, `FR`, `ES`, `KR`, `RU`. |

### Output

Each row in the dataset represents one video or Short:

| Field | Type | Description |
|---|---|---|
| `hashtag` | string | Normalized hashtag (no `#` prefix). |
| `position` | integer | 1-indexed position within the hashtag results. |
| `videoId` | string | YouTube video ID (use with `youtube.com/watch?v=<videoId>`). |
| `title` | string | Video title. |
| `channelName` | string | Name of the channel that posted the video. |
| `channelId` | string | YouTube channel ID (e.g. `UCxxxxxx`). |
| `channelUrl` | string | Full URL to the channel page. |
| `viewCountText` | string | Human-readable view count (e.g. `1.2M views`). |
| `publishedTimeText` | string | Relative publish time (e.g. `3 days ago`). Regular videos only. |
| `durationText` | string | Video duration (e.g. `12:34`). Regular videos only. |
| `thumbnailUrl` | string | URL of the highest-resolution thumbnail. |
| `isShort` | boolean | `true` if the item is a YouTube Short; `false` for regular videos. |
| `badges` | string[] | Optional content badges (e.g. `["CC", "4K"]`). Omitted when empty. |
| `scrapedAt` | string | ISO 8601 UTC timestamp of when the data was collected. |

> Fields that cannot be populated are omitted from the output rather than returned as `null`.

### Example Output

```json
[
  {
    "hashtag": "programming",
    "position": 1,
    "videoId": "dQw4w9WgXcQ",
    "title": "Learn Python in 10 Minutes",
    "channelName": "Code Academy",
    "channelId": "UC1234567890",
    "channelUrl": "https://www.youtube.com/@codeacademy",
    "viewCountText": "2.4M views",
    "publishedTimeText": "1 month ago",
    "durationText": "10:42",
    "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
    "isShort": false,
    "scrapedAt": "2026-06-19T10:00:00+00:00"
  },
  {
    "hashtag": "programming",
    "position": 2,
    "videoId": "abcde12345",
    "title": "#coding life 🖥️",
    "viewCountText": "58K views",
    "thumbnailUrl": "https://i.ytimg.com/vi/abcde12345/hqdefault.jpg",
    "isShort": true,
    "scrapedAt": "2026-06-19T10:00:00+00:00"
  }
]
````

### FAQ

**Do I need cookies or a YouTube account?**
No. YouTube hashtag pages are fully public. This actor uses HTTP requests only — no browser, no login, no cookies required.

**Why are some fields missing from Shorts?**
YouTube's Shorts cards don't expose channel info, duration, or publish time in the same way as regular videos. The scraper only outputs fields that actually contain data — no null/empty placeholders.

**How many results can I get per hashtag?**
Up to 500 per hashtag. YouTube typically loads around 24 videos per page; the scraper automatically paginates using YouTube's InnerTube API to collect more.

**What does the `market` setting do?**
It sets the `gl` (country) and `hl` (language) parameters on the request, which changes the regional ranking and language of results. Use `US` for English results.

**Can I scrape multiple hashtags at once?**
Yes — just add multiple entries to the `hashtags` list. The actor scrapes each hashtag sequentially and combines all results in the output dataset.

**What content types are available?**

- `all` — Scrapes the "All" tab (regular videos) plus the "Shorts" tab.
- `videos` — Scrapes only the "All" tab, skipping Shorts.
- `shorts` — Fetches only the "Shorts" tab content.

**What if a hashtag has no videos?**
The actor logs a warning and continues to the next hashtag — it won't crash the run.

### YouTube Scraper Suite

This actor is part of a complete YouTube data extraction toolkit. Explore the full suite:

| Actor | Description |
|-------|-------------|
| [YouTube Channel Scraper](https://apify.com/crawlerbros/youtube-channel-scraper) | Channel metadata, subscriber counts, and full video catalogs |
| [YouTube Channel Scraper Fast](https://apify.com/crawlerbros/youtube-channel-scraper-fast) | Streamlined channel scraper for high-volume and speed-sensitive workflows |
| [YouTube Comment Scraper](https://apify.com/crawlerbros/youtube-comment-scraper) | Comments, replies, likes, author info, and pinned/hearted status |
| [YouTube Email Scraper](https://apify.com/crawlerbros/youtube-email-scraper) | Creator contact emails from channel pages, Instagram, TikTok, and Linktree |
| [YouTube Hashtag Scraper](https://apify.com/crawlerbros/youtube-hashtag-scraper) | Videos and Shorts tagged with specific hashtags |
| [YouTube Playlist Scraper](https://apify.com/crawlerbros/youtube-playlist-scraper) | All videos and metadata from any YouTube playlist |
| [YouTube Search Scraper](https://apify.com/crawlerbros/youtube-search-scraper) | Search results including videos, channels, and playlists |
| [YouTube Shorts Scraper](https://apify.com/crawlerbros/youtube-shorts-scraper) | Shorts from channels or hashtags with full view and like metadata |
| [YouTube Transcript Scraper](https://apify.com/crawlerbros/youtube-transcript-scraper) | Timed transcripts and captions with optional Whisper AI fallback |
| [YouTube Trending Scraper](https://apify.com/crawlerbros/youtube-trending-scraper) | Ranked trending videos by category — Gaming, Music, News, Movies |
| [YouTube Video Details Scraper](https://apify.com/crawlerbros/youtube-video-details-scraper) | Comprehensive video metadata, chapters, endscreen, captions, and comments |
| [YouTube Video Downloader](https://apify.com/crawlerbros/youtube-video-downloader) | Download videos, playlists, and channels in any quality with metadata |

# Actor input Schema

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

List of hashtags to scrape. You can include or omit the # prefix — both formats are accepted (e.g. '#programming' or 'programming').

## `maxResultsPerHashtag` (type: `integer`):

Maximum number of videos to return per hashtag. Includes both regular videos and Shorts when content type is 'All'.

## `contentType` (type: `string`):

Which type of content to collect from the hashtag page.

## `market` (type: `string`):

Country/region for localized results. Sets the gl and hl URL parameters to return regionally relevant content.

## Actor input object example

```json
{
  "hashtags": [
    "#programming",
    "cooking"
  ],
  "maxResultsPerHashtag": 50,
  "contentType": "all",
  "market": "US"
}
```

# 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": [
        "#programming",
        "cooking"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/youtube-hashtag-scraper").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": [
        "#programming",
        "cooking",
    ] }

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "#programming",
    "cooking"
  ]
}' |
apify call crawlerbros/youtube-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/youtube-hashtag-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Hashtag Scraper",
        "description": "Scrape YouTube videos and Shorts by hashtag. Extract all videos tagged with specific hashtags including views, channel info, and metadata.",
        "version": "1.1",
        "x-build-id": "Ok0Kx8rHuaajcG807"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~youtube-hashtag-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-youtube-hashtag-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlerbros~youtube-hashtag-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-youtube-hashtag-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlerbros~youtube-hashtag-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-youtube-hashtag-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "hashtags"
                ],
                "properties": {
                    "hashtags": {
                        "title": "Hashtags",
                        "minItems": 1,
                        "type": "array",
                        "description": "List of hashtags to scrape. You can include or omit the # prefix — both formats are accepted (e.g. '#programming' or 'programming').",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResultsPerHashtag": {
                        "title": "Max Results Per Hashtag",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of videos to return per hashtag. Includes both regular videos and Shorts when content type is 'All'.",
                        "default": 50
                    },
                    "contentType": {
                        "title": "Content Type",
                        "enum": [
                            "all",
                            "videos",
                            "shorts"
                        ],
                        "type": "string",
                        "description": "Which type of content to collect from the hashtag page.",
                        "default": "all"
                    },
                    "market": {
                        "title": "Market / Region",
                        "enum": [
                            "US",
                            "GB",
                            "CA",
                            "AU",
                            "DE",
                            "FR",
                            "JP",
                            "KR",
                            "BR",
                            "IN",
                            "MX",
                            "IT",
                            "ES",
                            "NL",
                            "PL",
                            "RU",
                            "SE",
                            "NO",
                            "DK",
                            "FI",
                            "ZA",
                            "SG",
                            "HK",
                            "TW",
                            "ID",
                            "MY",
                            "TH",
                            "PH",
                            "AR",
                            "CO",
                            "CL"
                        ],
                        "type": "string",
                        "description": "Country/region for localized results. Sets the gl and hl URL parameters to return regionally relevant content.",
                        "default": "US"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
