YouTube hashtag API
The videos or Shorts on a YouTube hashtag page, about 30 a page.
GET /v1/youtube/hashtags/{tag}Beta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/youtube/hashtags/cooking?type=shorts",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "kind": "youtube#videoListResponse", "items": [ { "kind": "youtube#video", "id": "SN4DrMOH9YM", "snippet": { "title": "#funny #comedy #memes #cooking #food", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/SN4DrMOH9YM/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/SN4DrMOH9YM/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/SN4DrMOH9YM/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/SN4DrMOH9YM/sddefault.jpg", "width": 640, "height": 480 } }, "liveBroadcastContent": "none" }, "isShort": true, "statistics": { "viewCount": "5300000" }, "statisticsAreApproximate": true }, { "kind": "youtube#video", "id": "4WzURM-7Jnk", "snippet": { "title": "The Most Satisfying Village Feast Ever 🍴", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/4WzURM-7Jnk/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/4WzURM-7Jnk/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/4WzURM-7Jnk/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/4WzURM-7Jnk/sddefault.jpg", "width": 640, "height": 480 } }, "liveBroadcastContent": "none" }, "isShort": true, "statistics": { "viewCount": "133000000" }, "statisticsAreApproximate": true }, "… 1 more" ], "pageInfo": { "resultsPerPage": 6 }}Parameters
| Name | Type | Description |
|---|---|---|
tagpath · required | string | The hashtag, with or without #. Example: cooking. |
typequery | "all" | "shorts" | One of all, shorts. |
afterquery | string | The previous page’s nextPageToken. Tokens last 6 hours. |
Response fields
200 with a YouTubeVideoList, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#videoListResponse" | |
items | YouTubeVideo[] | |
nextPageToken | string | Pass as after for the next page. Absent on the last page. Lasts 6 hours. |
pageInfo | object | |
missing | object[] | Batch only: requested ids that did not resolve, and why. |
Status codes
| Status | Meaning |
|---|---|
200 | A page of tagged videos. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The video, channel, playlist or post does not exist, was removed, or has nothing there. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | YouTube is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
With or without #?
Either.
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.