alex01
alex01

Reputation: 23

The 'items' element in YouTube Data API search returns nothing when called '/videos'

Let's say i call the '/videos' search with the following payload:

{
  key: process.env.YOUTUBE_KEY,
  part: 'contentDetails,statistics,snippet',
  id: 'UCo8bcnLyZH8tBIH9V1mLgqQ',
  max_results: "5"
}

Then the following is the response:

{
  "kind": "youtube#videoListResponse",
  "etag": "\"Fznwjl6JEQdo1MGvHOGaz_YanRU/ftqcoEi5lFrDLEyLbPZCiTrEzXU\"",
  "pageInfo": {
    "totalResults": 0,
    "resultsPerPage": 0
  },
  "items": [

  ]
}

As you can see the items array is empty. I checked, my key is valid and the id is valid too.

Upvotes: 1

Views: 105

Answers (1)

johnh10
johnh10

Reputation: 4185

The /videos endpoint takes video IDs and you are passing in a channel ID.

Example url to get first video in that channel:

https://www.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics%2Cstatus&id=cV542dRK3uk&key=API_KEY

Upvotes: 1

Related Questions