13.1.0 generate_session_locally: true - no longer allows video playback
Steps to reproduce
Since February, my React Native app has been broken.
Previously, my code was:
innertubePromise = Innertube.create({
cache: new UniversalCache(false),
generate_session_locally: true,
retrieve_player: false,
});
Now, I can only use this version without generate_session_locally enabled:
innertubePromise = Innertube.create({
cache: new UniversalCache(false),
generate_session_locally: false,
enable_session_cache: true,
retrieve_player: false,
});
Since this change, Sentry has started logging the following error:
FetchStreamingUrlFailedError
Request to https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json failed with status 400
Failure Logs
(NOBRIDGE) LOG extras during init {"cause": undefined, "message": "Request to https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json failed with status 400", "name": "Error"}
Expected behavior
The parameter works as before.
Current behavior
The function does not work with this parameter.
Version
Default
Anything else?
No response
Checklist
- [x] I am running the latest version.
- [x] I checked the documentation and found no answer.
- [x] I have searched the existing issues and made sure this is not a duplicate.
- [x] I have provided sufficient information.
That option makes the library generate a random visitor data token. I believe YouTube no longer accepts these, hence why you get that error.
Maybe try setting up some persistent cache for the session so that you can use the data provided by YouTube without affecting your app's performance.
That option makes the library generate a random visitor data token. I believe YouTube no longer accepts these, hence why you get that error.
Maybe try setting up some persistent cache for the session so that you can use the data provided by YouTube without affecting your app's performance.
After testing all of this, I've come to the conclusion that the Innertube instance works intermittently and the workaround is to recreate it as soon as the video fails to play back
As the generate_session_locally parameter still works completely fine for everything other than video streams, removing the parameter doesn't make sense and the only action here is maybe adding a note to the documentation about it.