Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Visitor Data Producing Invalid Tokens Due to URL Decoding #21

Closed
wants to merge 1 commit into from

Conversation

WillKirkmanM
Copy link

During the process of grabbing the authentication tokens from YouTube's API, there is an issue where the Visitor Data token is returned with URL encoded padding characters (%3D) which is the ASCII representation of the equals character (=).

The fix is decoding the URL through python's standard library; urllib, we use it's .parse.unquote() function and then strip the characters from the end using rstrip('=').

@unixfox
Copy link
Member

unixfox commented Dec 4, 2024

How comes this is an issue? The visitordata used in the official www.youtube.com web interface, also ends with %3D

@WillKirkmanM
Copy link
Author

If you use the one ending in %3D, Invidious does not work.

@unixfox
Copy link
Member

unixfox commented Dec 16, 2024

Reviewing the PR, that's very odd. Could you do a video recording of installing invidious normally with docker: https://docs.invidious.io/installation/#docker then make the comparison with %3D added or removed.

This will help me a lot to understand what's going on. Thank you

@WillKirkmanM
Copy link
Author

Does your installation of invidious allow 1080p / 4K video playback with tokens that have %3D suffixed?

@unixfox
Copy link
Member

unixfox commented Dec 16, 2024

Does your installation of invidious allow 1080p / 4K video playback with tokens that have %3D suffixed?

How this has to do with 1080p video playback?

@WillKirkmanM
Copy link
Author

WillKirkmanM commented Dec 16, 2024

Invidious does not allow you to play 1080p / 4k (anything above 360p) unless you have the "DASH (adaptive quality)" setting as it defaults to medium and requires those two tokens to enable the higher quality playback.

@unixfox
Copy link
Member

unixfox commented Dec 16, 2024

But you need these two tokens for medium too. This is why I don't get it.

You are trying to say that DASH does not work without the %3D suffix removed but medium still works with %3D suffix?

@WillKirkmanM
Copy link
Author

Yes, my main goal is to be able to watch videos at normal quality (1080p), initially, I was only able to watch them at 360p and then discovered that DASH allows it but only if you have the two tokens.

When generating the tokens with this tool, it did not work initially until i removed the %3D suffix. When I removed the %3D suffix, I was able to watch the videos with the normal (1080p) quality with DASH

@unixfox
Copy link
Member

unixfox commented Dec 16, 2024

Ok! Great. Thank you for the feedback, now I understand much better the issue.

@unixfox
Copy link
Member

unixfox commented Dec 26, 2024

Hello,
I'm going to close this issue since I just tested and dash works fine with a visitordata that ends with %3D generated by default by youtube-trusted-session-generator.

On www.youtube.com, the visitordata also ends with %3D. Since this program basically just extract the same value that YouTube themselves generated, I prefer to keep the behavior this way.

@unixfox unixfox closed this Dec 26, 2024
@WillKirkmanM
Copy link
Author

Perfect, I am on TrueNas and using invidious through docker and it did not work for me. Should it persist, I'll open an issue 👍 Merci pour lê voir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants