Elijas / auto-youtube-subscription-playlist-2

Script automatically adds videos to playlists from Youtube channels and/or subscriptions (Youtube Collections alternative).
MIT License
246 stars 54 forks source link

Script doesn't work with empty channels #86

Closed Fabian42 closed 3 years ago

Fabian42 commented 3 years ago

There are a few channels that I added to my script to see if they ever upload videos. One example is this one: https://www.youtube.com/channel/UCAqzgFGOss0mFN0OUKkdqMw/videos When I add "UCAqzgFGOss0mFN0OUKkdqMw" to the sheet, I get this error message now:

Cannot search YouTube with playlist id UU2ynvCFT085PuHzwG0xO8nA, ERROR: Message: [API call to youtube.playlistItems.list failed with error: The playlist identified with the request's playlistId parameter cannot be found.] Details: {"code":404,"message":"The playlist identified with the request's playlistId parameter cannot be found.","errors":[{"reason":"playlistNotFound","location":"playlistId","locationType":"parameter","domain":"youtube.playlistItem","message":"The playlist identified with the request's playlistId parameter cannot be found."}]}

This did not use to happen, so I assume some YouTube API change broke it. It also happens with channels that used to have videos, but no longer do. The "<code>" tags are part of the error message, but get parsed by Github as markdown. I guess that's intentional.

victorjzsun commented 3 years ago

Yeah, noticed it too. It's due to the fact that getVideosWithLessQueries searches for new videos in an Uploads playlist rather than searching all of YT. Empty channels may or may not have this playlist and if it doesn't, it crashes the program. I'll add a check for these errors

JesperDramsch commented 3 years ago

Heya, I fixed it on my end just now, so I pushed the change to the repo @victorjzsun.