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

Better Player fetch #4089

Closed
wants to merge 6 commits into from
Closed

Conversation

knighthat
Copy link

I have done some rework on the request side of this app (Innertube)

Request headers

First of all, I update it to match YouTube Internal Clients's example

Then, I removed api key from default request. This is reserved for retires

Player body

As reported in YouTube Internal Clients#3. YouTube may request androidSdkVersion, racyCheckOk, as well as contentCheckOk in the body so I went a head and added them with default values

Conclusion

This is not a fix, just a workaround. As I observed, it only reduce the chance of getting "LOGIN_REQUIRED" but I think the result is really biased. Thus, I need more feedback to draw real conclusion.

Also, this only prevent YouTube from blocking from accessing the song at the beginning.
As far as my understanding, we are using Player with fetch song's stream by giving it the URL.
This makes it harder to hack since we don't have control of the data stream. In order to workaround this, we need a new Player that can give us direct access to the data stream.

What's next

I'm planing to do some rework with the response templates. Right now it's overwhelmed with nullable values.

My initial idea is that we return every request as an interface Response. Then we have classes like ErrorResponse or more specific LoginRequiredResponse etc. and PayloadResponse or PlayerResponse.

Each response only carries needed values and they are less likely to be null.

It's also easier to debug since we can check if Response falls into what category to take appropriate action

@fast4x
Copy link
Owner

fast4x commented Oct 21, 2024

Next version have just a workaround for login required, i have totally rewrited much code, now it work perfectly.

@knighthat
Copy link
Author

That's great.

Btw, the 0.6.57 seems to slow down the playback a lot. I notice some code being run multiple times but I did'nt have time to take a look. Can you check again?

@fast4x
Copy link
Owner

fast4x commented Oct 22, 2024

Yes I'll look into soon, thanks.

@fast4x fast4x closed this Oct 23, 2024
@fast4x
Copy link
Owner

fast4x commented Oct 23, 2024

One important thing, innertube and all modules in extensions are shared with the desktop project. It is best to avoid adding exclusive components in android by adding them directly into innertube.

Thanks for your contribute.

@knighthat
Copy link
Author

All files were created inside extensions/innertube, I created new packages because I didn't wanna break the working ones and for ease of reverse in case of failing

@fast4x
Copy link
Owner

fast4x commented Oct 23, 2024

yep

@knighthat
Copy link
Author

I forgot to mention, the commits are made to be working with different platforms, I already tested it on pc and android so you don't have to worry about that

@fast4x
Copy link
Owner

fast4x commented Oct 23, 2024

Ok thanks

@fast4x fast4x reopened this Oct 24, 2024
@fast4x
Copy link
Owner

fast4x commented Oct 24, 2024

After new release please re check this, thanks

@fast4x
Copy link
Owner

fast4x commented Oct 24, 2024

I think that this not necessary from now, YTM api seems to be only with login... working progress ..

@fast4x fast4x closed this Oct 24, 2024
@knighthat knighthat deleted the better-innertube branch October 30, 2024 16:52
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