YouTube Search API

The YouTube Search API allows you to search for YouTube videos based on specified parameters.

Base URL

"https://openapi-idk8.onrender.com"

Endpoints

  1. GET `/youtube/search`: Searches for YouTube videos based on specified parameters.

Query Parameters

  • q (required): The search query.
  • part (optional, default: 'snippet,id'): Comma-separated list of resource parts that the API response will include.
  • regionCode (optional, default: 'US'): The region code for the search.
  • maxResults (optional, default: 50): Maximum number of search results to return.
  • order (optional, default: 'date'): The order parameter specifies the method that will be used to order resources in the API response.

Sample Request

GET `https://openapi-idk8.onrender.com/youtube/search?q=billie+eilish&maxResults=10`

Sample Response

{
  "kind": "youtube#searchListResponse",
  "nextPageToken": "CDIQAA",
  "regionCode": "US",
  "pageInfo": {
    "totalResults": 1000000,
    "resultsPerPage": 50
  },
  "items": [
    {
      "kind": "youtube#searchResult",
      "id": {
        "kind": "youtube#video",
        "videoId": "EO0E21FL4MY"
      },
      "snippet": {
        "publishedAt": "2024-06-10T20:41:23Z",
        "channelId": "UCDGOO_t-jjPITczGN4aL9oQ",
        "title": "Billie eilish bored cover #billieeilish #bored #cover #billieeilishcover #shorts #viralshorts #fyp",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/EO0E21FL4MY/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/EO0E21FL4MY/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/EO0E21FL4MY/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "Rockahfiya🤞🏻",
        "liveBroadcastContent": "none",
        "publishTime": "2024-06-10T20:41:23Z"
      }
    },
    ...
  ]
}

Attributes

  • kind: The type of API response.
  • nextPageToken: Token to retrieve the next page of results.
  • regionCode: The region code for the search.
  • pageInfo: Information about the search results page.
  • items: An array of search result items.

Error Handling

If an error occurs while searching for YouTube videos, the API will respond with a 500 status code and an error message.