ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.36k stars 270 forks source link

bug(YouTube): Spoof app signature - various side effects #1257

Closed JUANHDA-CX closed 1 year ago

JUANHDA-CX commented 1 year ago

Type

Cosmetic

Description

YT-Advanced commented 1 year ago

The spoofed value works and seekbar thumbnails show up (need to also remove the integration code that hides the seekbar thumbnail). But, my account does not have issues playing without spoofing. So I cannot verify if playback works correctly and someone else would need to try. (Or maybe this was already tried, which is why the comment is now deleted?)

Can you share the apk, my device have spoof error Note: I deleted it because it is for reel_player, so I'm not sure it work with video_player

LisoUseInAIKyrios commented 1 year ago

If it's for reel_player, then it's another shorts spoof. Which means it may work for some users, but then fail for most others (video endlessly buffers around 1 minute mark)

YT-Advanced commented 1 year ago

If it's for reel_player, then it's another shorts spoof. Which means it may work for some users, but then fail for most others (video endlessly buffers around 1 minute mark)

You can try patching with this

The file is deleted. I know about shorts spoof so I want to test this new parameter

YT-Advanced commented 1 year ago

Seem like it worked

oSumAtrIX commented 1 year ago

The issue only appears after a couple of videos and minutes. Have you tested it extensively?

YT-Advanced commented 1 year ago

The issue only appears after a couple of videos and minutes. Have you tested it extensively?

Update, it not worked :))))

inotia00 commented 1 year ago

While checking NewPipe's code, I found that NewPipe implemented a seekbar thumbnail preview

1 2

Core source https://github.com/TeamNewPipe/NewPipe/tree/dev/app/src/main/java/org/schabi/newpipe/player/seekbarpreview

Point used by the player https://github.com/TeamNewPipe/NewPipe/blob/db5ed48dbb529c8bd0b0871724c821b666157aba/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java#L577

It basically has a structure that parses video streaming data through NewPipeExtractor and returns a thumbnail preview as a bitmap image (This doesn't seem very complicated, except that there are some dependencies missing from stock YouTube)

As far as I know, @LisoUseInAIKyrios has done enough reverse engineering to solve this issue before, so I think he knows in which class/method the bitmap image is applied If anyone has enough time to implement this, please try implementing it

I removed the development environment from all my PCs, so I can't test

YT-Advanced commented 1 year ago

I think Youtube have different encoder-decoder for thumbnail in incognito mode since the thumbnail can be used normally in Incognito mode. But now I have debugged and cannot found it lol

inotia00 commented 1 year ago

While checking NewPipe's code, I found that NewPipe implemented a seekbar thumbnail preview

Some side effects may theoretically be fixable

I've organized it in the gist document and fork repo, anyone want to track the issue, please refer to it

https://gist.github.com/inotia00/6ce9696a798a8b791dd0f2b4ec911a94 https://github.com/inotia00/revanced-patches/commit/ba9211ad739801c47928a47df3f8f217cc909c4c

oSumAtrIX commented 1 year ago

In a test build that hooked the hard-coded StoryBoard URL

Which method was hooked?

LisoUseInAIKyrios commented 1 year ago

Using the NewPipe approach of re-implementing the seekbar preview should be simple and straight forward...if the storyboard url can be determined and integrations can successfully fetch the url.

It appears NewPipe is using the storyboard url provided by YouTube, but if I'm following this correctly the storyboard url is not provided to ReVanced when using the current spoof signature.

Can this storyboard url be generated or otherwise reconstructed? If it's unique and there's no way to create a usable storyboard url, then does this path go anywhere?

oSumAtrIX commented 1 year ago

I believe they extract it this way:

https://github.com/TeamNewPipe/NewPipeExtractor/blob/3be76a6406d59f1fd8eedf5fab6552e6c2a3da76/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java#L1057C13-L1057C56

inotia00 commented 1 year ago

In a test build that hooked the hard-coded StoryBoard URL

Which method was hooked?

refer this commit https://github.com/inotia00/revanced-patches/commit/ba9211ad739801c47928a47df3f8f217cc909c4c

inotia00 commented 1 year ago

fix for clip

https://github.com/inotia00/revanced-integrations/commit/6f36c858f96105461bd5ce881c40809b16497161

fix for ambient mode, filmstrip overlay, thumbnail preview in seekbar

https://github.com/inotia00/revanced-patches/commit/4eead50c70e1f254579877054dd86259872ad006

https://github.com/inotia00/revanced-integrations/commit/49d63c2dadda8eccf40342c895295b0c5d63aa75

I tried to leave as many comments as possible and made minimal modifications from the official source

since the fetch API is finished before the PlayerResponse is generated by YouTube, bottlenecks are not expected to occur, but limit it to volatile or synchronized if necessary

quality of the seekbar thumbnail preview is very low, so it seems to separate patch is needed for this in the class that handles the storyboards (It would be nice to see who implemented the alternative thumbnail patch)

LisoUseInAIKyrios commented 1 year ago

I was working on integrating NewPipe extractor as a dependent library to fetch the storyboard spec url but was still working out the patch points needed. I now have the NewPipe extractor working as an alternative integrations implementation for fetching the storyboard url, but it still produces the exact same storyboard spec url, and gives the same low resolution thumbnail images. Not to mention it's a lot of code to import when Inotia's implementation accomplishes the same (and it seems NewPipe is slower since it's doing a lot of tasks not needed for this).

From what I understand, there are multiple sizes of thumbnails and NewPipe is selectively picking the larger of them during it's own implementation of the thumbnails. The NewPipe fetch of the storyboard spec produces two sets of seekbar thumbnail urls: https://i.ytimg.com/sb/asdfjkl/storyboard3_L1/M0.jpg?... // 45 pixel height https://i.ytimg.com/sb/asdfjkl/storyboard3_L2/M1.jpg?... // 90 pixel height (which appears to still be lower resolution than without spoofing)

I assume the YouTube client is using the first thumbnail url set or it's otherwise getting confused to which it should use. In theory this could be fixed by forcing YouTube to use the higher resolution urls. Worse case scenario can use the NewPipe approach and re-implement the seekbar thumbnails in the same manner NewPipe does.

Since the seekbar image view is already known, it could be resized a little smaller and these low resolution images might look better. But I'm not sure if this would be desirable or not.

oSumAtrIX commented 1 year ago

@LisoUseInAIKyrios See https://github.com/ReVanced/revanced-integrations/compare/bfae6b56ab0f...2cd1738d2494 for a slightly refactored version

oSumAtrIX commented 1 year ago

I have locally implemented a way to display the thumbnail with the highest quality. I'll push it in some minutes, once I have refactored it.

oSumAtrIX commented 1 year ago

Here is the fix https://github.com/ReVanced/revanced-patches/commit/5e8a2d3fe77a4a08ea32e7dc22f2c8e4048b7a6b

xDARKxDEVILx commented 1 year ago

Damn, it feels so good seeing 11 out of 13 finally, thanks to everyone working on this 🙂

oSumAtrIX commented 1 year ago

All should be fixed now

johnconner122 commented 1 year ago

All should be fixed now

It fails to load thumbnail if video more than an Hour long. e.g; https://www.youtube.com/live/ZUXEviR5TmI

oSumAtrIX commented 1 year ago

Works for me

johnconner122 commented 1 year ago

Works for me

Tells me: Failed to get StoryboardRenderer

LisoUseInAIKyrios commented 1 year ago

Tells me: Failed to get StoryboardRenderer

StoryboardRenderer error toast was fixed just a few minute ago.

But this video does not show thumbnails for me either. It does show thumbnails when not spoofing.

I think it's because the YouTube storyboard is still showing it's a livestream (which has no seekbar thumbnails):

getStoryboardRendererUsingBody: {"playabilityStatus":{"status":"OK"},"storyboards":{"playerLiveStoryboardSpecRenderer":{"spec":"https:\/\/i.ytimg.com\/sb\/ZUXEviR5TmI\/storyboard_live_90_3x3_b1\/M$M.jpg?rs=asdfjkl#159#90#3#3"}}}

oSumAtrIX commented 1 year ago

Makes sense, I was specifically trying 1 hour long videos that were not live streams, so that worked for me.

Qaz-6 commented 1 year ago

Finally all the features will work normally, and there will be no video freezing problems?🤔

LisoUseInAIKyrios commented 1 year ago

It fails to load thumbnail if video more than an Hour long. e.g; https://www.youtube.com/live/ZUXEviR5TmI

Thumbnails now are working for this video. It's probably because the video was very low view count, and it took a few hours for the player spec to update to "no longer live" status.

GKid94 commented 1 year ago

I have bad live stream quality when the spoof option is enabled Screenshot_2023-10-01-00-23-04-470_app revanced android youtube Screenshot_2023-10-01-00-23-08-719_app revanced android youtube Screenshot_2023-10-01-00-23-28-071_com miui securitycenter

LisoUseInAIKyrios commented 1 year ago

@GKid94 you have the quality set to automatic, and YouTube will pick whatever quality it wants.

Set a default quality in Settings -> ReVanced -> Video

GKid94 commented 1 year ago

@GKid94 you have the quality set to automatic, and YouTube will pick whatever quality it wants.

Set a default quality in Settings -> ReVanced -> Video

I have a good connection

SodaWithoutSparkles commented 1 year ago

I have a good connection

Doesn't stop youtube being funky at times. Maybe they just wanna cheap out on bandwidth and hope that you did not notice.

GKid94 commented 1 year ago

I have a good connection

Doesn't stop youtube being funky at times. Maybe they just wanna cheap out on bandwidth and hope that you did not notice.

YouTube is getting worse and worse 😕

johnconner122 commented 1 year ago

I have been buffering issues for a few days now after playing a video after a minute or two. It started after or with following changes.

StoryboardRenderer error toast was fixed just a few minute ago.

If I use previous releases code, before above mentioned fix, it works fine without any buffering issues.

LisoUseInAIKyrios commented 1 year ago

I have been buffering issues for a few days now after playing a video after a minute or two. It started after or with following changes.

It might be https://github.com/ReVanced/revanced-patches-template/issues/293

Check the debug logs, and see if the protobuffer hook is being called. I encountered playback problems and found it was caused by YT using a different player response code path that seems to be account/region/install specific. The player parameter protobuffer hook was not being called, and thus playback was as if spoofing as turned off. After uninstalling and reinstalling the issue went away and the existing hook was called again for me.

oSumAtrIX commented 1 year ago

@LisoUseInAIKyrios They were using dev patches which had a bug with the hooks not being properly added to the app. This was fixed a day after, so repatching will work around the playback issue once again as supposed

LisoUseInAIKyrios commented 1 year ago

Then that most likely was the issue I experienced, and why it later resolved itself.

xDARKxDEVILx commented 1 year ago

It only took 6 months and 20 days to close this issue XD

Qaz-6 commented 1 year ago

Screenshot_20231005-161802_YouTube Did you forget to delete it? Or is one still working and the other not working?

oSumAtrIX commented 1 year ago

Not sure what you mean, but you disabled the patch.

Qaz-6 commented 1 year ago

Some features don't work when this patch is on. Video playback issues when it's off. What's a better solution to have both?

xDARKxDEVILx commented 1 year ago

Some features don't work when this patch is on. Video playback issues when it's off. What's a better solution to have both?

There are almost no side effects when it is on now

Qaz-6 commented 1 year ago

In this case, we should remove the side effects. People should not be confused

xDARKxDEVILx commented 1 year ago

In this case, we should remove the side effects. People should not be confused

What? Just read the side effects when it is enabled, we can't just remove them

Qaz-6 commented 1 year ago

Why? If there are no side effects, why are the notes there?

LisoUseInAIKyrios commented 1 year ago

The remaining side effects are not encountered for normal and common usage.

If these last few edge case issues really bother you, then pay for YouTube Premium in your home country and then you can usually turn off all spoofing without issues.

Qaz-6 commented 1 year ago

Is YouTube's paid videos policy back?😏 Damn it