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 Music search #484

Merged
merged 4 commits into from
Dec 25, 2020
Merged

Fix YouTube Music search #484

merged 4 commits into from
Dec 25, 2020

Conversation

TobiGr
Copy link
Member

@TobiGr TobiGr commented Dec 17, 2020

YouTube changed the JSON structure

Fixes TeamNewPipe/NewPipe#5191
@badprogramshere Can you test the APk below and tell me if you spot any bugs?

app-debug.zip

@TobiGr TobiGr added bug youtube service, https://www.youtube.com/ labels Dec 17, 2020
@badprogramshere
Copy link

badprogramshere commented Dec 18, 2020

Sorry about the delay! I've just tested it. I can search albums correctly and play most tracks as usual, but the album content seems to include music videos with the normal YouTube Music tracks. This isn't too much of a problem for the most part though, and this is the same content from the desktop website, so I don't think this can be fixed.

@TobiGr
Copy link
Member Author

TobiGr commented Dec 18, 2020

I noticed that, too. However, that is the result YouTube Music also uses on their website. So I cannot do much about it.

@badprogramshere
Copy link

Yeah, I can understand that. Thanks for the patch anyway! I can tolerate having to use the music-video versions of songs.

@TobiGr
Copy link
Member Author

TobiGr commented Dec 19, 2020

You should get the YouTube Music version of the videos now. app-debug.zip

@TiA4f8R I don't know what you mean. I could not get this data. Did you inspect the website to get that JSON?

@TobiGr
Copy link
Member Author

TobiGr commented Dec 19, 2020

ah ok. YouTube provides a different JSON to the browser version. I cannot use that info in this case.

Try that: app-debug.zip

@TobiGr TobiGr requested a review from Stypox December 19, 2020 13:27
@AudricV
Copy link
Member

AudricV commented Dec 21, 2020

@TobiGr It will be great if this fix is included in 0.20.7.

@TobiGr
Copy link
Member Author

TobiGr commented Dec 21, 2020

Added to the to do for 0.20.7.
However, I cannot reproduce your json structure.
Can give me clear steps what to search and which filters to use to get a your file containing a toggledServiceEndpoint?

A separate questions is whether the playlist id allows tracking

@AudricV
Copy link
Member

AudricV commented Dec 22, 2020

@TobiGr First about tracking, there's no tracking in the playlist itself if you use this endpoint. The "clickTrackingParams" is only used in the website or in YT Music's app, that you can see many times in the JSON response.
About giving you clear steps, I will first try something on my local side and let you know if that I did works.

@AudricV
Copy link
Member

AudricV commented Dec 22, 2020

@TobiGr So can you do the contrary?

@TobiGr
Copy link
Member Author

TobiGr commented Dec 22, 2020

@TiA4f8R see #484 (comment)

@TobiGr
Copy link
Member Author

TobiGr commented Dec 22, 2020

ah i see. our test cases are bad.
Thanks for your patience!

@B0pol
Copy link
Member

B0pol commented Dec 23, 2020

Exception

Crash log

org.schabi.newpipe.extractor.exceptions.ParsingException: Got HTML document, expected JSON response (latest url was: "https://www.youtube.com/watch?v=CLAK5uy_l5C")
	at org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getValidJsonResponseBody(YoutubeParsingHelper.java:575)
	at org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getResponse(YoutubeParsingHelper.java:588)
	at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeMixPlaylistExtractor.onFetchPage(YoutubeMixPlaylistExtractor.java:59)
	at org.schabi.newpipe.extractor.Extractor.fetchPage(Extractor.java:54)
	at org.schabi.newpipe.extractor.playlist.PlaylistInfo.getInfo(PlaylistInfo.java:30)
	at org.schabi.newpipe.util.ExtractorHelper.lambda$getPlaylistInfo$9(ExtractorHelper.java:172)
	at org.schabi.newpipe.util.-$$Lambda$ExtractorHelper$RLOrwix0kCDfcc_WpFBc8DTJw0Q.call(Unknown Source:4)
	at io.reactivex.rxjava3.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:43)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.single.SingleDoOnSuccess.subscribeActual(SingleDoOnSuccess.java:35)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeFromSingle.subscribeActual(MaybeFromSingle.java:41)
	at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.drain(MaybeConcatArray.java:153)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.request(MaybeConcatArray.java:78)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe$ElementAtSubscriber.onSubscribe(FlowableElementAtMaybe.java:66)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray.subscribeActual(MaybeConcatArray.java:42)
	at io.reactivex.rxjava3.core.Flowable.subscribe(Flowable.java:15753)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe.subscribeActual(FlowableElementAtMaybe.java:36)
	at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle.subscribeActual(MaybeToSingle.java:46)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
	at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614)
	at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
	at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)


Copy link
Member

@B0pol B0pol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes, you can merge after this

…Tube Mix type with calling the dedicated methods
@TobiGr TobiGr merged commit b5e50cc into dev Dec 25, 2020
@TobiGr TobiGr deleted the yt_,music_search branch December 25, 2020 17:30
@TeamNewPipe TeamNewPipe deleted a comment from TobiGr Dec 30, 2020
@TeamNewPipe TeamNewPipe deleted a comment from TobiGr Dec 30, 2020
@TeamNewPipe TeamNewPipe deleted a comment from opusforlife2 Dec 30, 2020
@TeamNewPipe TeamNewPipe deleted a comment from opusforlife2 Dec 30, 2020
@TeamNewPipe TeamNewPipe deleted a comment from TobiGr Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug youtube service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Filtering for YouTube Music items shows 'No results'
5 participants