-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Newpipe extractor #199
base: dev
Are you sure you want to change the base?
Newpipe extractor #199
Conversation
//includeBuild("../TubularExtractor") { | ||
// dependencySubstitution { | ||
// substitute(module("com.github.gechoto:NewPipeExtractor")) | ||
// .using(project(":extractor")) | ||
// } | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work for you without removing the version?
Because for me it doesn't which is one reason why I did not add it.
// We assume, that NewPipe and NewPipe Extractor have the same parent directory. | ||
// If this is not the case, please change the path in includeBuild(). | ||
|
||
//includeBuild("../TubularExtractor") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TubularExtractor is out of date and there is nothing needed from it anyway so I think the original NewPipeExtractor should be preferred here instead (also matches the comment above)
|
||
|
||
// Use a local copy of NewPipe Extractor by uncommenting the lines below. | ||
// We assume, that NewPipe and NewPipe Extractor have the same parent directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know you renamed OuterTune to NewPipe.
Big announcement when?
funny how you squashed my commits but forgot the most important one: maybe because it didn't exist a few minutes ago? (sorry about the amount of commits) |
ytClient(YouTubeClient.WEB_REMIX, true) | ||
parameter("ver", "2") | ||
parameter("c", "ANDROID_MUSIC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to be a mix of WEB_REMIX and ANDROID_MUSIC?
maybe just do this:
suspend fun registerPlayback(url: String, cpn: String, playlistId: String?, client: YouTubeClient = YouTubeClient.WEB_REMIX)
= httpClient.get(url) {
ytClient(client, true)
parameter("ver", "2")
parameter("c", client.clientName)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It worked correctly, so I kept it as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good idea. It just makes the request look very unofficial and suspicious.
That said it should be handled separately. I don't even understand why this change is part of this PR since it has nothing to do with NewPipeExtractor or the player request changes.
if (playerResponse.playabilityStatus.status == "OK") { | ||
if (registerPlayback) | ||
registerPlayback(playlistId, playerResponse.playbackTracking?.videostatsPlaybackUrl?.baseUrl!!) | ||
|
||
return@runCatching playerResponse | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not in a great place. I suggest to make the player
and registerPlayback
requests two separate independent things.
Registering playback while doing the player request does not make much sense to me because the player request does not guarantee playback and the player
request does not depend on registering playback.
Also I think the code would be easier to read when having two separate function calls where needed instead of adding more parameters (like registerPlayback
) to the player
function.
IMO something like this:
sitDown()
eat()
drink()
Is more clear than this:
sitDown(alsoEat, alsoDrink)
What do you think about that design?
My preferred solution would be:
In the innertube
module:
- remove the
registerPlayback: Boolean = true
parameter from theplayer
function - the
player
function should only do the player request and not call any other api endpoints unless it depends on them
In the app
module:
- in places you only need the player response just call the
player
function - in places you want to register playback call the
player
function and afterwards theregisterPlayback
function - the
registerPlayback
call could be inYTPlayerUtils
for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the TubularExtractor stuff, I wanted to implement try implementing sponsorblock (... eventually). It was a mostly painless merge to get that up to date.
Does this work for you without removing the version?
Because for me it doesn't which is one reason why I did not add it.
It doesn't, but I'd also want to have it it as an option for future use. I'll put a note about the version thing
I think this is not in a great place. I suggest to make the player and registerPlayback requests two separate independent things.
Yep. Good ideas. Most of this was trying to not refactor the entire code there. For this pr think it's probably best to leave that as is though. You're right, since it doesn't even adhere to how this history is tracked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the TubularExtractor stuff, I wanted to implement try implementing sponsorblock (... eventually)
Sponsorblock API looks easy enough to integrate I don't it needs a library for that.
Even if you decide to go with TubularExtractor you can switch to it later when needed. But for now NewPipeExtractor makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: Tubular looks unmaintained now.
Using a dead library is not great.
Just gives you another repo to maintain and makes pulling in or committing upstream fixes take extra steps.
Apart from that I think it makes more sense to have stream extraction and Sponsorblock separated. These are two different things which should be replaceable independent of each other.
When it comes to that TubularExtractor does not follow a good design.
For Sponsorblock I think it should be a module like other data providers already are (see kugou
and lrclib
) and have nothing to do with innertube
or NewPipe stuff.
This way it will be easier to replace only specific modules in case something breaks.
playedFormat: FormatEntity?, | ||
audioQuality: AudioQuality, | ||
connectivityManager: ConnectivityManager, | ||
registerPlayback: Boolean = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently unused. Maybe this should be used to decide if it should call YouTube.registerPlayback
before returning PlaybackData
.
Ah. That came after, yeah. I meant to mark this pr as draft since idk if I want to do a proper rebase and outertune changes on top of your stuff... I got it working and didnt feel like it was time for rebase hell lol |
There is one thing still unfinished from the original InnerTune PR and I'm not sure what to do about it: Idk what do you think? Can it be removed or should it be adapted? |
Uhhh I think you're probably more suited to make that call, in all honesty, I really do not enjoy touching innertube, and I don't think newpipe has that figured out either(?) Personally, I'd say "do the best-est thing". since you're trying to fix playback with Innertune, it's probably best to fix that and worry about proxy later (probably only used by a fraction of the userbase), and then remove the UI parts so it doesn't confuse the user, and then reintroduce proxy the future. Maybe wait for z-huang to re-awaken ¯_(ツ)_/¯ |
No idea if it is worth it keeping the proxy settings but just to make this complete I added proxy support now to the new http clients. |
This reverts commit 51431f4.
YTPlayerUtils: catch & report url validation errors update NewPipeExtractor make `signatureTimestamp` optional and report exception if it could not be parsed move NewPipe functions to `NewPipeUtils` reduce duplicate code in YTPlayerUtils and skip url status validation for last client improved url deobfuscation error handling YouTubeTest: use IOS client update NewPipeExtractor skip WEB_CREATOR client for logged out users TVHTML5 requires login
1959468
to
c2416be
Compare
* Adhere to pause listen history for remote content
|
||
|
||
// | ||
// /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gechoto I tried doing what you suggested with moving the register playback to here... but to no avail. Do you have any idea why? The decoupling thing however, yeah... that made a lot of sense to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what I meant.
The function doing the registerPlayback
request is something suited for innertune
.
My idea was to just not call/run the function from within innertune
but in YTPlayerUtils
instead.
There could be a wrapper in YTPlayerUtils
for it which reports exceptions just like it is done for getSignatureTimestampOrNull
and findUrlOrNull
.
(also the wrapper function in YTPlayerUtils
could be responsible for checking settings in the future in case you want to add an option for users to enable/disable register playback
@mikooomich should I open a PR which replaces this one but includes all my suggestions? |
Yep, it'll be less janky than my attempt 😄 |
|
What is it?
Description of the changes in your PR
Fixes the following issue(s)
Due diligence