Open opusforlife2 opened 3 years ago
I think this exception is reproducible with more than 100 number of characters (including spaces) in search query in NewPipe for Youtube service.
Try searching in the app any text which exceeds 100 characters (including spaces) like following text:-
Chand Se Mukhatib rare song Kumar Sanu Remastered HQ high quality dolby atmos surround sound flac aud
& extractor returns exception as in my following comment in form of a snackbar error.
Now try the search one more time with one less character e.g. remove the last alphabet "d" from search field & no such exception takes place.
Finally you can Calmly count searched characters (including spaces) to determine exact figure above which extractor fails to get suggestions or whatever.
Nice, that's exactly right!
Latest Error Report to above reported bug to help developers debug the issue..
org.schabi.newpipe.extractor.exceptions.ExtractionException: Invalid response type (got "text/html; charset=UTF-8", excepted a JSON response) (response code 400)
at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSuggestionExtractor.suggestionList(YoutubeSuggestionExtractor.java:71)
at org.schabi.newpipe.util.ExtractorHelper.lambda$suggestionsFor$2(ExtractorHelper.java:110)
at org.schabi.newpipe.util.ExtractorHelper.$r8$lambda$kgV3vMftlbQH0zdv8hszrHLyMLU(ExtractorHelper.java:0)
at org.schabi.newpipe.util.ExtractorHelper$$ExternalSyntheticLambda14.call(R8$$SyntheticClass:0)
at io.reactivex.rxjava3.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:43)
at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4855)
at io.reactivex.rxjava3.internal.operators.single.SingleToObservable.subscribeActual(SingleToObservable.java:36)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
at io.reactivex.rxjava3.internal.operators.observable.ObservableZip$ZipCoordinator.subscribe(ObservableZip.java:110)
at io.reactivex.rxjava3.internal.operators.observable.ObservableZip.subscribeActual(ObservableZip.java:72)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
at io.reactivex.rxjava3.internal.operators.observable.ObservableMaterialize.subscribeActual(ObservableMaterialize.java:28)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
at io.reactivex.rxjava3.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.onNext(ObservableSwitchMap.java:128)
at io.reactivex.rxjava3.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver$DelayErrorInnerObserver.onNext(ObservableConcatMap.java:500)
at io.reactivex.rxjava3.observers.SerializedObserver.onNext(SerializedObserver.java:114)
at io.reactivex.rxjava3.internal.operators.observable.ObservableDebounceTimed$DebounceTimedObserver.emit(ObservableDebounceTimed.java:156)
at io.reactivex.rxjava3.internal.operators.observable.ObservableDebounceTimed$DebounceEmitter.run(ObservableDebounceTimed.java:181)
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:264)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
This behavior happen even on the official clients (I only tested the web ones), YouTube returns Google's 400 HTTP HTML responses when a suggestion has more than 100 characters saying Your client has issued a malformed or illegal request. That’s all we know.
Workarounds would be to return an empty search suggestion list when a search suggestion request has more than 100 characters (I prefer this solution) or when we get a 400 HTTP response with a HTML Content-Type
HTTP header.
For reference, Piped backends block requests to search suggestions with more than 100 characters, returning an error response saying that query is too long
.
Checklist
Steps to reproduce the bug
This only happens for Youtube, and not the other services.
I haven't investigated this much. But @ShareASmile did, and found out the 100 character threshold!
Actual behaviour
Snackbar error.
Expected behavior
No snackbar error.
Logs
Exception
Crash log