YouTube videos by hashtag
Beta GET /v1/youtube/search/hashtag
GET /v1/youtube/search/hashtag
Videos (or Shorts) on a hashtag's page. The all tab holds about 30 videos and usually no next page; the short tab pages with cursor.
- Cost: 1 credit
- Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
hashtag | string | yes | Hashtag, with or without #. |
type | string | no | Kind of result. One of all, short. Also accepted values: shorts for short. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
curl
curl -G "https://api.socialscrape.io/v1/youtube/search/hashtag" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode "hashtag=minecraft"Python
import os
import requests
params = {
"hashtag": "minecraft",
}
res = requests.get(
"https://api.socialscrape.io/v1/youtube/search/hashtag",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])TypeScript
const url = new URL("https://api.socialscrape.io/v1/youtube/search/hashtag");
url.search = new URLSearchParams({
"hashtag": "minecraft"
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}n8n
{
"nodes": [
{
"name": "SocialScrape YouTube videos by hashtag",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/youtube/search/hashtag",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "hashtag",
"value": "minecraft"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_1f827a4f0a9a06a75bba3a8b",
"data": {
"object": "list",
"items": [
{
"object": "post",
"platform": "youtube",
"id": "PkI-vfHANSE",
"url": "https://www.youtube.com/watch?v=PkI-vfHANSE",
"type": "video",
"author": {
"id": "UC0h07r_UgTD0Tc-Dn5XLX3g",
"handle": null,
"name": "Wisp",
"url": "https://www.youtube.com/channel/UC0h07r_UgTD0Tc-Dn5XLX3g",
"avatar_url": null,
"verified": true
},
"title": "Minecraft, But Fishing Drops Custom Items...",
"text": null,
"published_at": "2026-10-29T00:00:00Z",
"duration_seconds": 2376.0,
"language": null,
"hashtags": null,
"mentions": null,
"stats": {
"views": 475245,
"likes": null,
"comments": null,
"shares": null,
"saves": null,
"dislikes": null
},
"media": {
"thumbnail_url": "https://i.ytimg.com/vi/PkI-vfHANSE/hq2.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBvwWMnkOQPKX7UyJXSmA1PjZWcfA",
"video_url": null,
"audio_url": null,
"image_urls": null,
"width": null,
"height": null
},
"song": null,
"location": null,
"is_pinned": null,
"is_sponsored": null,
"extra": {
"published_at_approximate": true,
"published_text": "1 day ago",
"views_text": "475,245 views"
}
},
{
"object": "post",
"platform": "youtube",
"id": "UJXwiq0AnW4",
"url": "https://www.youtube.com/watch?v=UJXwiq0AnW4",
"type": "video",
"author": {
"id": "UCWVSknuLPIRVGWf-4bFKT4Q",
"handle": null,
"name": "Johnny Minecraft",
"url": "https://www.youtube.com/channel/UCWVSknuLPIRVGWf-4bFKT4Q",
"avatar_url": null,
"verified": true
},
"title": "Hiding in a SECRET BASE INSIDE the TOILET in Minecraft",
"text": null,
"published_at": "2026-10-29T18:00:00Z",
"duration_seconds": 807.0,
"language": null,
"hashtags": null,
"mentions": null,
"stats": {
"views": 81512,
"likes": null,
"comments": null,
"shares": null,
"saves": null,
"dislikes": null
},
"media": {
"thumbnail_url": "https://i.ytimg.com/vi/UJXwiq0AnW4/hq2.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAlD9UeQyyO3xbKOCesoAfzKuw9xg",
"video_url": null,
"audio_url": null,
"image_urls": null,
"width": null,
"height": null
},
"song": null,
"location": null,
"is_pinned": null,
"is_sponsored": null,
"extra": {
"published_at_approximate": true,
"published_text": "8 hours ago",
"views_text": "81,512 views"
}
}
],
"cursor": null,
"has_more": false,
"parent": null
},
"cursor": null,
"has_more": false
}Response#
A list of Post objects in data.items, with data.cursor and data.has_more.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
Every request can also fail with the account and platform errors listed on the Errors page.
Related endpoints#
- YouTube channel details (
GET /v1/youtube/channel) - YouTube channel videos (
GET /v1/youtube/channel/videos) - Search inside a YouTube channel (
GET /v1/youtube/channel/search) - YouTube channel playlists (
GET /v1/youtube/channel/playlists) - YouTube channel Shorts (
GET /v1/youtube/channel/shorts) - YouTube channel live streams (
GET /v1/youtube/channel/lives) - YouTube channel community posts (
GET /v1/youtube/channel/community-posts) - YouTube video or Short details (
GET /v1/youtube/video)