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: play song without login #1690

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

Malopieds
Copy link
Contributor

Fix for avoiding having to login to listen to music, replace the IOS player too. I don't know if we should keep the IOS player as a back up too or not. Issue #1653

I reversed the cna function, for n and signature, transpiled into kotlin to avoid using js directly from kotlin. If you have any question, please ask.

Malopieds and others added 2 commits October 28, 2024 21:39
reversed cna function for n and signature function, transpiled into kotlin
@ihaadi
Copy link

ihaadi commented Oct 29, 2024

I've tested the APK, and the app works well overall. However, the download feature no longer seems to function properly. I’ve tried downloading several songs, but it doesn’t work
Notworking2

@gechoto
Copy link
Contributor

gechoto commented Oct 29, 2024

It is really cool that you figured that out, thanks a lot @Malopieds
However I do not feel very confident about this approach yet.

If it would reliably just work like this why do other projects like yt-dlp use a JS interpreter and a cache for different versions of these JS functions? They are probably not doing this just for fun.
Will be interesting to see how this holds up longterm.

I don't know if we should keep the IOS player as a back up too or not.

If this will be merged and released soon (without any longterm testing) I think it makes sense to keep the IOS player.
Might be good to have a back up since we don't know yet how stable this will be.

@Malopieds
Copy link
Contributor Author

If it was that easy

That's the thing. It's not that easy. It looks easy but finding how it's done is not easy at all and require a lot of time.

why do other projects like yt-dlp use a JS interpreter.

Because this is the easy part. Not having to understand the code and just run it.

Will be interesting to see how this holds up longterm.

Yep I agree, this can be easily changed at anytime by YouTube, it's not AS future proof as using js in kotlin directly. But yet, it's not in their interest to update it too often.

Both methods have their pros and cons. A lot of libs for youtube uses js/ts so it's even simpler.

But if you have other ideas I'm glad to implement this another way!

@xhyrom
Copy link

xhyrom commented Nov 1, 2024

Works perfectly for me but sometimes when I play video instead of song, e. g. "delacey - dream it possible" the app crashes.

@javdc
Copy link
Contributor

javdc commented Dec 18, 2024

It seems that this doesn't work anymore, for me everything that is not cached shows "Unknown error" and doesn't play. In logcat ExoPlayer says Source error, with the cause Response code: 403. I suppose something changed in the API and the generated stream urls doesn't work anymore. NewPipe is working fine though. Clearing app data doesn't fix the issue.

@gechoto
Copy link
Contributor

gechoto commented Dec 19, 2024

@Malopieds please make it so that this replaces the ANDROID_MUSIC client instead of the IOS one

Because the ANDROID_MUSIC client is completely broken currently. Without login it will error because it needs sign in and with login it fails with "Request contains an invalid argument."
So unless someone figures out how to send login info now with the ANDROID_MUSIC client I guess it can be removed (or commented out for now).

The IOS client still somewhat works (without sending login info - I can create a PR afterwards forcing this) so I think it is worth keeping it.

@gechoto gechoto mentioned this pull request Dec 19, 2024
4 tasks
@javdc
Copy link
Contributor

javdc commented Dec 19, 2024

I can confirm, changing the player client from WEB_REMIX to IOS also works for me, it even plays explicit songs without logging in.

I uploaded a build with these changes in case anyone wants to try. The icon is more blueish to distinguish it from the original Innertune.

InnerTune PR 1690 with IOS player.zip

@gechoto
Copy link
Contributor

gechoto commented Dec 20, 2024

changing the player client from WEB_REMIX to IOS also works for me, it even plays explicit songs

Maybe this depends on the country or "age-restricted" and "explicit" are two different things.


@Malopieds since the current approach is broken what do you think about this:
https://developer.android.com/develop/ui/views/layout/webapps/jsengine

But you will need to extract the js functions for this to work

Another alternative might be this fork of NewPipeExtractor (with login support):
https://codeberg.org/NullPointerException/PipePipeExtractor

UPDATE: In one of the latest changelogs of PipePipe they wrote:

Sign in does not work due to new blocking (YouTube)

And they added yt-dlp as fallback:
https://codeberg.org/NullPointerException/PipePipeClient/commit/2c0f45ee1fba576aa2fa823629d820c1b0a9f8d3

InnerTune could also add yt-dlp. This might be the most reliable solution. The only downsides to this so far: yt-dlp needs python and adding this makes the app big and slow so starting playback takes a while.

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.

7 participants