Handle unplayable content better with the local API #5922
Merged
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.
Handle unplayable content better with the local API
Pull Request Type
Related issue
closes #3238
Description
This pull request introduces better handling for unplayable videos with the local API. As Invidious only returns the error message we cannot do anything like this for the Invidious backend, the same goes for private videos because YouTube only returns the please log-in message for those.
Currently when you encounter an unplayable video in FreeTube the watch page just breaks, this pull request changes that for members-only and age-restricted videos as well as when the user is IP blocked and has backend fallback disabled, by parsing as much metadata as possible so that the only missing information is the video player itself. For the IP blocked case, that required falling back to information from the
/next
response as the/player
response is missing a lot of information when the IP block error is returned.As age-restricted videos and member-only videos require a YouTube account, this pull request intentionally doesn't attempt to fallback to Invidious for those videos, as they will fail with Invidious too.
Screenshots
Members-only video
Age-restricted video
Age-restricted movie trailer
IP blocked with backend fallback disabled
Testing
Make sure you are using the local API.
If you have access to a blocked IP address you can also test that the error message is shown instead of the player when backend fallback is disabled and that it still falls back to the Invidious API when backend fallback is enabled.
Regression test, as the trailer handling code changed:
Desktop