Implement content and session PO tokens
Implement content and session PO tokens
Pull Request Type
- [x] Bugfix
Related issue
Will link it after other devs have confirmed that it solves the issue for them too.
Description
YouTube has switched from just using session based PO tokens that are added to the streaming URLs, which is what we are currently doing, to also introducing content PO tokens which are tied to the video ID added to the /player request. This pull request implements that new PO token. Challenges are now fetched from the https://www.youtube.com/api/jnn which is a proxy for jnn-pa.googleapis.com instead of fetching it directly from the latter URL, which should hopefully help with people's misconfiguring their ad-blocker to block jnn-pa.googleapis.com.
This will definitely have code conflicts with the potoken proxy pull request, I will resolve the code conflicts in whichever pull request is merged later.
Testing
Open various videos and check that you don't get any 403s or Error: Error invoking remote method 'generate-po-token' errors.
Desktop
- OS: Windows
- OS Version: 10
- FreeTube version: e4092aa2c2d1575538159cb7a44a78b238132dc7
Putting into custom build to test for 1 week+
This pull request has conflicts, please resolve those before we can evaluate the pull request.
Conflicts have been resolved. A maintainer will review the pull request shortly.
I don't experience this bug in my regular usage but will start testing this build.
Hello
I was testing Pikachu's build 212 and encountered the following error
I was mostly listening to music
https://github.com/PikachuEXE/FreeTube/actions/runs/13626508576
https://github.com/PikachuEXE/FreeTube/commit/e910c0d3fbdfc21cf41e7a6f55b22f1f08e9cefa
Failed to load resource: the server responded with a status of 404 ()
renderer.js:2 Local API, poToken generation failed Error: Error invoking remote method 'generate-po-tokens': Error: [BotGuardClient]: Async snapshot function not found
at IpcRenderer.invoke (node:electron/js2c/renderer_init:2:7076)
at async eX (renderer.js:2:1836327)
at async r.getVideoInformationLocal (renderer.js:2:2301068)
eX @ renderer.js:2
@ArthurKun21 That build is based on the older commits that were using a hardcoded timeout which is no longer present in the latest commits. If you want to help test PRs, please make sure you are actually using the latest changes next time before commenting that something doesn't work for you.
2nd 403 in a short period of testing and i cant replicate this behavior at all on the nightly build which im almost using daily
I got several 403 but not frequently and I did not use normal build for a while so no idea if YT doing stuff or this PR causing it