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(YouTube - Spoof video streams): Log out the iOS client to allow kids videos playback #4000

Merged
merged 6 commits into from
Nov 27, 2024

Conversation

oSumAtrIX
Copy link
Member

@oSumAtrIX oSumAtrIX commented Nov 27, 2024

YouTube now has restricted the auth token to their respective client. This mean's the Android token can not be used for iOS or VR requests anymore (More info yt-dlp/yt-dlp#11640 (comment)).

Private or kids' videos can not be played without logging in.

The only solution here is to ask the user to log in, or somehow handle the login to other clients when the user logs into GmsCore.

Currently, VR seems to work with the Android auth token. This means, that private videos will work. What won't work is private kids videos, because VR is the only authorized client currently, and that one can't play kids videos.

@oSumAtrIX
Copy link
Member Author

@LisoUseInAIKyrios If the first requests fail, should a toast be shown, even if the second or third attempt worked?

@oSumAtrIX
Copy link
Member Author

@LisoUseInAIKyrios A way to reduce the amount of requests made to YouTube could be via analysing which clients succeed the most. So if someone is watching kids videos exclusively, the IOS client will be preferred.

@oSumAtrIX
Copy link
Member Author

The only way I am seeing to restore playback on private or restricted videos is to use a client that can authorize using the Android Bearer token. Since iOS and VR don't accept the auth token from Android, the only way to play those videos with other clients is to ask the user to login to get the auth token via the auth method used for the other clients. This is not really elegant since the user would have to login twice, once for the Android app, and once for the private videos. The alternative solution is to generate a login for other clients via GmsCore. This would require implementing additional code when the user logs into the app, so that it also manages the login of the user for the other clients.

@oSumAtrIX oSumAtrIX changed the title fix(YouTube - Spoof video streams): Use logged out client first fix(YouTube - Spoof video streams): Log out the iOS client to allow kids videos playback Nov 27, 2024
@LisoUseInAIKyrios
Copy link
Contributor

What changes are needed to the settings side effect summaries?

@Karthik-Subbu
Copy link

Should Android TV client be added to support playback of kids videos (private/public) in addition to IOS logged out?

@LisoUseInAIKyrios
Copy link
Contributor

@LisoUseInAIKyrios If the first requests fail, should a toast be shown, even if the second or third attempt worked?

If I understand this correctly, if the user has iOS as their preferred client then it will fail for private kids videos but it then succeeds when it automatically falls over to Android VR. In this situation I think showing an error is confusing as the playback did work.

@LisoUseInAIKyrios
Copy link
Contributor

What changes are needed to the settings side effect summaries?

So the only side effects to add to iOS, is that private kids videos will still use Android VR?

Maybe keep it simple and just state "Kids videos may not playback", when they will playback but will fallback to Android VR.

@oSumAtrIX
Copy link
Member Author

Android VR can not play kids videos. Public or private. Only iOS can. And since iOS is not authorized, private kids video can not be played on any circumstance. This is a limitation unless we can somehow make an authorized request with a client other than Android VR but since the auth token is constrained to it's platform, that's not gonna be easy

@Karthik-Subbu
Copy link

Could android tv client with existing auth token play private kids video?

@LisoUseInAIKyrios
Copy link
Contributor

Can merge #4010 after this PR is merged.

So many users think "app version == patch version" which makes it harder to troubleshoot when they are using old patches.

@oSumAtrIX
Copy link
Member Author

oSumAtrIX commented Nov 27, 2024

Could android tv client with existing auth token play private kids video?

If they restrict auth to their respective platform, probably not.

@oSumAtrIX oSumAtrIX merged commit cc2ac4e into dev Nov 27, 2024
1 check passed
github-actions bot pushed a commit that referenced this pull request Nov 27, 2024
# [5.2.0-dev.5](v5.2.0-dev.4...v5.2.0-dev.5) (2024-11-27)

### Bug Fixes

* **YouTube - Spoof video streams:** Log out the iOS client to restore kids videos playback ([#4000](#4000)) ([cc2ac4e](cc2ac4e))

### Features

* **TikTok:** Add ReVanced settings about screen ([#4009](#4009)) ([12ea26b](12ea26b))
@kitadai31
Copy link
Contributor

kitadai31 commented Nov 27, 2024

Should Android TV client be added to support playback of kids videos (private/public) in addition to IOS logged out?

I also thought the same thing

In ReVanced Extended, kids videos is playing with Android TV client correctly
It tries the clients in the order of iOS -> Android VR -> Android TV

D/Extended: StreamingDataRequest: Fetching video streams for: 5gZOYKHXwyQ using client: IOS
I/Extended: StreamingDataRequest: IOS not available with response code: 400 message: Bad Request
D/Extended: StreamingDataRequest: video: 5gZOYKHXwyQ took: 123ms
D/Extended: StreamingDataRequest: Fetching video streams for: 5gZOYKHXwyQ using client: ANDROID_VR
D/Extended: StreamingDataRequest: video: 5gZOYKHXwyQ took: 414ms
D/Extended: StreamingDataRequest: Fetching video streams for: 5gZOYKHXwyQ using client: ANDROID_UNPLUGGED
D/Extended: StreamingDataRequest: video: 5gZOYKHXwyQ took: 206ms
D/Extended: SpoofStreamingDataPatch: Overriding video stream: 5gZOYKHXwyQ

I've not tested the private kids video, though.

However, it seems that Android TV cannot play copyrighted musics(?).
(I don't know the exact condition.)
So, if the video is "kids video" and "copyrighted music", all clients other than logged out iOS are not available.

https://www.youtube.com/watch?v=e_04ZrNroTo is an example.

D/Extended: StreamingDataRequest: Fetching video streams for: e_04ZrNroTo using client: IOS
I/Extended: StreamingDataRequest: IOS not available with response code: 400 message: Bad Request
D/Extended: StreamingDataRequest: video: e_04ZrNroTo took: 63ms
D/Extended: StreamingDataRequest: Fetching video streams for: e_04ZrNroTo using client: ANDROID_VR
D/Extended: StreamingDataRequest: video: e_04ZrNroTo took: 328ms
D/Extended: StreamingDataRequest: Fetching video streams for: e_04ZrNroTo using client: ANDROID_UNPLUGGED
D/Extended: StreamingDataRequest: video: e_04ZrNroTo took: 164ms
I/Extended: StreamingDataRequest: Could not fetch any client streams
D/Extended: SpoofStreamingDataPatch: Not overriding streaming data (video stream is null): e_04ZrNroTo

By the way, Android TV doesn't seem to be available unless you're logged in.
But since iOS works if you are not logged in, I think the two clients can cover each other's weaknesses.

Edited: It seems I was too late. It had been merged while I was writing this.

@oSumAtrIX oSumAtrIX deleted the fix/spoof-video-streams branch November 27, 2024 13:46
github-actions bot pushed a commit that referenced this pull request Nov 27, 2024
# [5.2.0](v5.1.0...v5.2.0) (2024-11-27)

### Bug Fixes

* **My Expenses - Unlock pro:** Constrain compatible version to working version ([#3974](#3974)) ([ba3bf69](ba3bf69))
* **YouTube - Hide Shorts components:** Add missing options to patch ([65f62fc](65f62fc))
* **YouTube - Playback speed:** Allow long press 2x speed when using custom playback speeds ([#3990](#3990)) ([79a543a](79a543a))
* **YouTube - Settings:** Do not clip settings menus when using an Android 15 device ([#3999](#3999)) ([7382a02](7382a02))
* **YouTube - Settings:** Show navigation back button in setting sub menus ([#3991](#3991)) ([e61686c](e61686c))
* **YouTube - Spoof video streams:** Log out the iOS client to restore kids videos playback ([#4000](#4000)) ([cc2ac4e](cc2ac4e))

### Features

* **TikTok:** Add ReVanced settings about screen ([#4009](#4009)) ([12ea26b](12ea26b))
* **VSCO:** Remove non functional `Unlock pro` patch ([4fddb19](4fddb19))
* **YouTube - Theme:** Apply custom seekbar color to splash screen animation ([#3978](#3978)) ([98d57e2](98d57e2))
* **YouTube:** Support version `19.46.42` ([#4010](#4010)) ([122aac6](122aac6))
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.

bug(YouTube - Spoof video streams): Spoofing client "iOS" doesn't work
4 participants