InfoKuris
InfoKuris

Reputation: 31

Using the YouTube API I'm getting "invalid filter parameter" error. What is wrong with my code?

Here is a link to a direct copy of the spreadsheet: Sheets

The script that has stopped working is called "Live", 24 Hour still works as intended. When running the script (as it should On Open) it no longer updates, instead the following error message appears;

GoogleJsonResponseException: API call to youtube.videos.list failed with error: The request specifies an invalid filter parameter. (line 41, file "Live")

I haven't touched or changed anything about the script since it was created, and I have been using the same script for several months on each spreadsheet I have (youll notice the spreadsheet is named after the month its in use)

Upvotes: 3

Views: 2158

Answers (1)

Aerials
Aerials

Reputation: 4419

You are exceeding the maxResults filter's maximum of 50 Ids.

You are making a request to YouTube.Videos.List and using the id filter.

  • The maxResults Optional parameter states a max value of 50, even though not in conjuction with the id filter.
  • However, when testing your script with more than 50 Ids, I too got the error.

Solution:

  • Keep the max Ids per request at 50. (Make multiple requests if needed.)

Docs:

Youtube API Videos.List documentation.

Upvotes: 7

Related Questions