FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Implement content and session PO tokens

Open absidue opened this issue 10 months ago • 4 comments

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

absidue avatar Feb 26 '25 18:02 absidue

Putting into custom build to test for 1 week+

PikachuEXE avatar Feb 27 '25 00:02 PikachuEXE

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Mar 02 '25 15:03 github-actions[bot]

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Mar 02 '25 15:03 github-actions[bot]

I don't experience this bug in my regular usage but will start testing this build.

kommunarr avatar Mar 02 '25 16:03 kommunarr

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

bundle.log

ArthurKun21 avatar Mar 05 '25 11:03 ArthurKun21

@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.

absidue avatar Mar 05 '25 15:03 absidue

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

VirtualBoxVM_CynvPYgPHQ

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

PikachuEXE avatar Mar 12 '25 22:03 PikachuEXE