Check YouTube playlists for unplayable videos while queuing them #1230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR avoids crashes while playing YouTube playlists with unplayable videos in them. The errors I got looked like this:
The playlist items are checked for deleted and private videos first and the region restrictions of the remaining ones after that. To be able to check if the video ist blocked in the current country the new environment variable
IP_COUNTRY_CODE
must be set to the country code of the servers IP (added a note for it to the README). If unplayable videos were detected, the bot sends a new message before the Now Playing message, which lists them by their playlist index (starting at 1) and looks something like this:I also started to integrate the region restriction checks to the single video querying, but for some odd reason it's not a problem there. While the Video unavailable error was thrown for blocked videos in playlists, they are playing just fine when adding them on their own. Thats the reason behind the comment at src/services/youtube-api.ts:124.