YouTube Music Pagination API

YouTube Music loads more results as you scroll, but only when a filter is selected. A search with the filter parameter has about 20 results on each page. A search without it has one page.

To get the next page, use the next_page_token from serpapi_pagination, or follow serpapi_pagination.next. When serpapi_pagination is missing, there is no next page.


The API endpoint is https://serpapi.com/search?engine=youtube_music

Head to the playground for a live and interactive demo.

API parameters

next_page_token

Optional

Parameter defines the next page token. It is used for retrieving the next page of results. It should be a value of next_page_token from the serpapi_pagination of the search results. Pagination is only available when the filter parameter is set.

API examples

Example results for q: Opeth and filter: songs

serpapi_pagination has the next_page_token of the next page, and next, the SerpApi link to it.


JSON Example

{
  ...
  "search_parameters": {
    "engine": "youtube_music",
    "q": "Opeth",
    "filter": "songs"
  },
  ...
  "organic_results": [
    {
      "type": "song",
      "title": "Ghost of Perdition",
      "link": "https://music.youtube.com/watch?v=3NttJB0DfiQ",
      "serpapi_youtube_video_link": "https://serpapi.com/search.json?engine=youtube_video&v=3NttJB0DfiQ",
      "video_id": "3NttJB0DfiQ",
      "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"
        }
      ],
      "album": {
        "title": "Ghost Reveries",
        "album_id": "MPREb_WB23W1ATIMj",
        "link": "https://music.youtube.com/browse/MPREb_WB23W1ATIMj"
      },
      "length": "10:30",
      "plays": "8.4M plays",
      "extracted_plays": 8400000,
      "thumbnail": "https://yt3.googleusercontent.com/ZMyer-WsRHve3938fizI_Epzi7G_msIUgyzWpyq2uDyUpMq8DUCkKRYAIhrntMq-lJjsmjVtdSFgAxb4=w120-h120-l90-rj"
    },
    ...
  ],
  "serpapi_pagination": {
    "next_page_token": "EqYDEgVPcGV0aBqcA0VnV0tBUUlJQVVnVWFoSVFCUkFERUFr...",
    "next": "https://serpapi.com/search.json?engine=youtube_music&filter=songs&next_page_token=EqYDEgVPcGV0aBqcA0VnV0tBUUlJQVVnVWFoSVFCUkFERUFr...&q=Opeth"
  }
}

Example with next_page_token

The next page of the songs for Opeth, with the next_page_token of the first page. Its own serpapi_pagination leads to the page after it.

Example with next_page_token

JSON Example

{
  ...
  "search_parameters": {
    "engine": "youtube_music",
    "q": "Opeth",
    "filter": "songs",
    "next_page_token": "EqYDEgVPcGV0aBqcA0VnV0tBUUlJQVVnVWFoSVFCUkFERUFr..."
  },
  ...
  "organic_results": [
    {
      "type": "song",
      "title": "The Night And The Silent Water",
      "link": "https://music.youtube.com/watch?v=2lrYAlgPAUQ",
      "serpapi_youtube_video_link": "https://serpapi.com/search.json?engine=youtube_video&v=2lrYAlgPAUQ",
      "video_id": "2lrYAlgPAUQ",
      "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"
        }
      ],
      "album": {
        "title": "Morningrise",
        "album_id": "MPREb_dcBvnxvAzcJ",
        "link": "https://music.youtube.com/browse/MPREb_dcBvnxvAzcJ"
      },
      "length": "11:00",
      "plays": "515K plays",
      "extracted_plays": 515000,
      "thumbnail": "https://yt3.googleusercontent.com/E45ReRQl0pt2OZoJdxPILZWZAPkbKzCBFT-x8j5NVPPFkl6jU6qSAXJfN8NFg-W49_OGtoQeIx1TdGdX=w120-h120-l90-rj"
    },
    {
      "type": "song",
      "title": "Dirge for November",
      "link": "https://music.youtube.com/watch?v=vsTFEEZXHEo",
      "serpapi_youtube_video_link": "https://serpapi.com/search.json?engine=youtube_video&v=vsTFEEZXHEo",
      "video_id": "vsTFEEZXHEo",
      "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"
        }
      ],
      "album": {
        "title": "Blackwater Park",
        "album_id": "MPREb_QJ7Jz0Ej2PV",
        "link": "https://music.youtube.com/browse/MPREb_QJ7Jz0Ej2PV"
      },
      "length": "7:52",
      "plays": "1.8M plays",
      "extracted_plays": 1800000,
      "thumbnail": "https://yt3.googleusercontent.com/pbeSQKin_slf4RiwVySQe-ulJ5Ydr49fWsor_3P8_odbPywaWRoZscqpqWPNMMXJvwJDVRlOiIGq7Hs=w120-h120-l90-rj"
    },
    ...
  ],
  "serpapi_pagination": {
    "next_page_token": "EqYDEgVPcGV0aBqcA0VnV0tBUUlJQVVnb2FoSVFCUkFERUFr...",
    "next": "https://serpapi.com/search.json?engine=youtube_music&filter=songs&next_page_token=EqYDEgVPcGV0aBqcA0VnV0tBUUlJQVVnb2FoSVFCUkFERUFr...&q=Opeth"
  }
}

JSON structure overview

{
  ...
  "serpapi_pagination": {
    "next_page_token": "String - Token to get the next page of results",
    "next": "String - YouTube Music API link to get the next page of results",
  },
}