YouTube Music Filtering API
Use the filter parameter to get results of one type, like the chips below the YouTube Music search box. A filtered search has about 20 results on each page, and you can get the next pages.
The API endpoint is https://serpapi.com/search?engine=youtube_music
Head to the playground for a live and interactive demo.
API parameters
filter
Optional
Parameter defines the type of results to return in organic_results. Available options:songs - Songs, with the type: songvideos - Videos, with the type: videoalbums - Albums, with the type: albumartists - Artists, with the type: artistcommunity_playlists - Community playlists, with the type: playlistfeatured_playlists - Featured playlists, with the type: playlistpodcasts - Podcasts, with the type: podcastepisodes - Episodes, with the type: episodeprofiles - Profiles, with the type: profile
YouTube Music sometimes mixes in results of another type, e.g. episodes among videos, audiobooks among albums or audiobook tracks among songs. They keep their own type, e.g. episode, audiobook or track.
When it's not set, the top results of all types are returned, and there is no next page.
API examples
Example for q: Opeth with filter: albums
The results are the albums that match the query. Each result has the type: album.
{
...
"search_parameters": {
"engine": "youtube_music",
"q": "Opeth",
"filter": "albums"
},
...
"organic_results": [
{
"type": "album",
"title": "Blackwater Park",
"link": "https://music.youtube.com/browse/MPREb_QJ7Jz0Ej2PV",
"album_id": "MPREb_QJ7Jz0Ej2PV",
"playlist_id": "OLAK5uy_m3dqkdL56PUbwr_3sgBY_T2x_yFbwLI9k",
"album_type": "Album",
"channels": [
{
"name": "Opeth",
"channel_id": "UCPDNZZQOlPKYnL64i9cCXFA",
"link": "https://music.youtube.com/channel/UCPDNZZQOlPKYnL64i9cCXFA",
"serpapi_youtube_channel_link": "https://serpapi.com/search.json?channel_id=UCPDNZZQOlPKYnL64i9cCXFA&engine=youtube_channel"
}
],
"year": 2001,
"thumbnail": "https://yt3.googleusercontent.com/pbeSQKin_slf4RiwVySQe-ulJ5Ydr49fWsor_3P8_odbPywaWRoZscqpqWPNMMXJvwJDVRlOiIGq7Hs=w544-h544-l90-rj"
},
{
"type": "album",
"title": "Ghost Reveries",
"link": "https://music.youtube.com/browse/MPREb_WB23W1ATIMj",
"album_id": "MPREb_WB23W1ATIMj",
"playlist_id": "OLAK5uy_kqQKBsAxjjCLHaZM0HsxpBWRgjEKBzqnQ",
"album_type": "Album",
"channels": [
{
"name": "Opeth",
"channel_id": "UCPDNZZQOlPKYnL64i9cCXFA",
"link": "https://music.youtube.com/channel/UCPDNZZQOlPKYnL64i9cCXFA",
"serpapi_youtube_channel_link": "https://serpapi.com/search.json?channel_id=UCPDNZZQOlPKYnL64i9cCXFA&engine=youtube_channel"
}
],
"year": 2005,
"thumbnail": "https://yt3.googleusercontent.com/ZMyer-WsRHve3938fizI_Epzi7G_msIUgyzWpyq2uDyUpMq8DUCkKRYAIhrntMq-lJjsmjVtdSFgAxb4=w544-h544-l90-rj"
},
...
],
...
}
Example for q: Opeth with filter: community_playlists
Community playlists are the playlists of YouTube Music users. They have the type: playlist, the same as featured playlists.
{
...
"search_parameters": {
"engine": "youtube_music",
"q": "Opeth",
"filter": "community_playlists"
},
...
"organic_results": [
{
"type": "playlist",
"title": "OPETH \"Soft Collection\"",
"link": "https://music.youtube.com/playlist?list=PLqVyC8Qgp_1bBarhGkmK6jo2GyxW4aPg_",
"playlist_id": "PLqVyC8Qgp_1bBarhGkmK6jo2GyxW4aPg_",
"channel": {
"name": "Mika Väliaho",
"channel_id": "UCmVe_WyyE4jeMM3KtuGbqCw",
"link": "https://music.youtube.com/channel/UCmVe_WyyE4jeMM3KtuGbqCw",
"serpapi_youtube_channel_link": "https://serpapi.com/search.json?channel_id=UCmVe_WyyE4jeMM3KtuGbqCw&engine=youtube_channel"
},
"views": "583 views",
"extracted_views": 583,
"thumbnail": "https://yt3.googleusercontent.com/dbDJ4p1GCflcdhnz27_9uMfyduArYewagp_I_kcpnwgLI_KGI1vUF1PJnsFZd9Y7dWykUSoU8Q=s1200"
},
{
"type": "playlist",
"title": "Opeth 2006",
"link": "https://music.youtube.com/playlist?list=PL6QO5UqFxBPHgpAUCnrl3A9r5qxoWLhnG",
"playlist_id": "PL6QO5UqFxBPHgpAUCnrl3A9r5qxoWLhnG",
"channel": {
"name": "Roman Kaslivtsev",
"channel_id": "UCrONvcSwTrxWTywyL7b1pLQ",
"link": "https://music.youtube.com/channel/UCrONvcSwTrxWTywyL7b1pLQ",
"serpapi_youtube_channel_link": "https://serpapi.com/search.json?channel_id=UCrONvcSwTrxWTywyL7b1pLQ&engine=youtube_channel"
},
"views": "3.5K views",
"extracted_views": 3500,
"thumbnail": "https://i.ytimg.com/vi/OnUS8pRR310/hq720.jpg?sqp=-oaymwEKCNUGEN8DIABIWg&rs=AMzJL3n8nh-kFg_rsk8NOovQGeX3AexUAA"
},
...
],
...
}