YouTube Channel Videos API Documentation
The YouTube Channel Videos API, accessible via the /api/v1/search?engine=youtube_channel_videos
endpoint, provides detailed information about YouTube channel videos. This API allows you to retrieve various data about a channel, including its statistics, video list, and more.
API Parameters
Search Query
-
- Name
-
channel_id
- Required
- Required
- Description
-
Identifies the YouTube channel to query. Accepts a channel ID or an '@' handle from YouTube URLs. For channel IDs, use the format:
https://www.youtube.com/channel/CHANNEL_ID
. For '@' handles, use:https://www.youtube.com/@HANDLE
. Examples:UCXZCJLdBC09xxGZ6gcdrc6A
for channel IDs;@BostonDynamics
for '@' handles.
Localization
-
- Name
-
gl
- Required
- Optional
- Description
-
The default parameter
us
defines the country of the search. Check the full list of supported YouTubegl
countries.
-
- Name
-
hl
- Required
- Optional
- Description
-
The default parameter
en
defines the interface language of the search. Check the full list of supported YouTubehl
languages.
Pagination
-
- Name
-
next_page_token
- Required
- Optional
- Description
-
A token used to retrieve the next page of videos or apply specific filters such as "Popular" or "Oldest". On the first request, the API response includes a
pagination.filters
array, which provides tokens for different sorting options. The default sorting is "Most Recent". Use thenext_page_token
for a selected filter to retrieve results for that filter. For subsequent requests within the same filter, use thepagination.next_page_token
from the response to continue pagination.
Engine
-
- Name
-
engine
- Required
- Required
- Description
-
Parameter defines the engine that will be used to retrieve real-time data. To retrieve YouTube video details, it must be set to
youtube_channel_videos
.
API key
-
- Name
-
api_key
- Required
- Required
- Description
-
The
api_key
authenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY
) or in the Authorization header (Bearer YOUR_API_KEY
).
API Examples
Channel
https://www.searchapi.io/api/v1/search?channel_id=%40NBA&engine=youtube_channel_videos
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "youtube_channel_videos",
"channel_id": "@NBA"
}
response = requests.get(url, params=params)
print(response.text)
{
"channel": {
"handle": "@NBA",
"id": "UCWJ2lWNubArHWmf3FIHbfcQ",
"title": "NBA",
"description": "The NBA is the premier professional basketball league in the United States and Canada. The league is truly global, with games and programming in 215 countries and territories in 47 languages. The NBA consists of 30 teams. The NBA offers real time access to live regular season NBA games with a subscription to NBA LEAGUE PASS, available globally for TV, broadband, and mobile. Real-time Stats, Scores, Highlights and more are available to fans on web and mobile with the NBA App. \n\nFor news, stories, highlights and more, go to our official website at https://app.link.nba.com/e/NBA_site\n",
"keywords": "NBA \"Full Game Recaps\" \"Full Game Highlights\"",
"tags": ["NBA", "Full Game Recaps", "Full Game Highlights"],
"available_countries": [
"EC",
"KG",
...
],
"badges": ["NBA", "Verified"],
"first_link": "https://nba.smart.link/ASVote-YTBio",
"is_verified": true,
"is_family_safe": true,
"banner": "https://yt3.googleusercontent.com/zm0mPlH4bTDl5JEC6s7ccWiB20LkoszUnHxEC38TCtTp-yMejjZEx_eUD7r1tnZtI4ck-Ibgsw=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj",
"avatar": "https://yt3.googleusercontent.com/CQS5cYQGRAIMMYpMg224tikkhZKnQeuQPIVEHu4sBI3vkceTprP5GoT3y8-hca7LXWzQkfrT=s900-c-k-c0x00ffffff-no-rj"
},
...
}
Videos
The pagination.filters
array in the response provides sorting options like "Popular" or "Oldest", each with a next_page_token
to retrieve results for that filter.
For instance, use the token from the "Popular" filter to get the most popular videos.
For subsequent pages within a filter or for default pagination (most recent videos), use the pagination.next_page_token
.
https://www.searchapi.io/api/v1/search?channel_id=%40lexfridman&engine=youtube_channel_videos
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "youtube_channel_videos",
"channel_id": "@lexfridman"
}
response = requests.get(url, params=params)
print(response.text)
{
"videos": [
{
"position": 1,
"id": "yhZAXXI83-4",
"title": "Adam Frank: Alien Civilizations and the Search for Extraterrestrial Life | Lex Fridman Podcast #455",
"link": "https://www.youtube.com/watch?v=yhZAXXI83-4",
"views": 304741,
"channel": {
"is_verified": true
},
"length": "3:26:40",
"published_time": "18 hours ago",
"thumbnail": {
"static": "https://i.ytimg.com/vi/yhZAXXI83-4/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLAnbz8rg7C-l6aOw7lDAjUhkHRQ2g",
"rich": "https://i.ytimg.com/vi/yhZAXXI83-4/hqdefault.jpg?sqp=-oaymwEiCMQBEG5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLA3aTxZLhT2z93XuJ6cbM8lO_6Exw"
}
},
...
],
"pagination": {
"filters": [
{
"text": "Popular",
"next_page_token": "4qmFsgJkEhhVQ1NIWkt5Y..."
},
{
"text": "Oldest",
"next_page_token": "4qmFsgJkEhhVQ1NIWkt5YXd..."
}
],
"next_page_token": "4qmFsgKrCBIYVUNTSFpLeWF3Yjc..."
}
}
Popular Videos
https://www.searchapi.io/api/v1/search?channel_id=%40lexfridman&engine=youtube_channel_videos&next_page_token=4qmFsgJkEhhVQ1NIWkt5YXdiNzdpeERkc0dvZzRpV0EaSDhnWXVHaXg2S2hJbUNpUTJPVE0yWlRnNFppMHdNREF3TFRJd09UWXRPV05sWXkwMU9ESTBNamxpTm1Jek0yTWdBZyUzRCUzRA%3D%3D
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "youtube_channel_videos",
"channel_id": "@lexfridman",
"next_page_token": "4qmFsgJkEhhVQ1NIWkt5YXdiNzdpeERkc0dvZzRpV0EaSDhnWXVHaXg2S2hJbUNpUTJPVE0yWlRnNFppMHdNREF3TFRJd09UWXRPV05sWXkwMU9ESTBNamxpTm1Jek0yTWdBZyUzRCUzRA=="
}
response = requests.get(url, params=params)
print(response.text)
{
"videos": [
{
"position": 1,
"id": "T3FC7qIAGZk",
"title": "Andrew Bustamante: CIA Spy | Lex Fridman Podcast #310",
"link": "https://www.youtube.com/watch?v=T3FC7qIAGZk",
"views": 19165254,
"channel": {
"is_verified": true
},
"length": "3:53:09",
"published_time": "2 years ago",
"thumbnail": {
"static": "https://i.ytimg.com/vi/T3FC7qIAGZk/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLCLRQXK9OAMfxc6dzivXTUqnBfz3A",
"rich": "https://i.ytimg.com/vi/T3FC7qIAGZk/hqdefault.jpg?sqp=-oaymwEiCMQBEG5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLBspolBUYGvbeOtJUJRC2-EOCPq-w"
}
},
...
],
"pagination": {
"next_page_token": "4qmFsgLZCBIYVUNTSFpLeWF3Yjc3aXhEZHNHb2c0..."
}
}