youtube_api
youtube_api copied to clipboard
Index out of range error
I had a problem with your plugin today. Suddenly it stopped working returning an error about an index out of range.
I've figured out that the problem is that the YT api value "total results" returns an approximation, therefore you can't use it as the max value of a for loop.
Check the documentation here: https://developers.google.com/youtube/v3/docs/search/list
In my case I had 13 videos, but the total results value was 14.
So, in your plugin you should replace all the occurrences of jsonData['pageInfo']['totalResults'] with Jason data['items'].length
Hope this helps!