Skip to content
Advertisement

Youtube API Playlist – List playlist stopped working

I have a strange issue on a system that creates a youtube playlist, and then fills the playlist with videos from a database table.

The code is Version Controlled by GIT, and have no commits in the code for 3-4 months, and it has worked up to a couple of days back.

Suddenly it can’t find the items, and therefore doesn’t find the id, of the item that it should find. The system creates a list, then find the latest created playlist (which is the one you just created), and then fills the playlist up normally.

I’m not very good as javascript to be honest, are there any good javascript developers out there that can solve this? The error seems pretty common when googling, but In addition to the youtube api use, I find it hard to figure out the issue. Why it suddenly doesn’t result items. (If I run a GET in Postman, ill get the correct playlist, so it should be something in the code that isn’t working 100%)

JavaScript

}

This is what happens now: Error

And as you can see the items array is empty.

Advertisement

Answer

I have now solved it!

By breaking down the function into smaller functions it seems to give me the correct result. Why the problem suddenly occured is still uknown, but I’m glad it now works.

This is the final solution if others out there are trying to solve similiar issue.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement