-
Notifications
You must be signed in to change notification settings - Fork 431
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
Add new exceptions to be able to display different error messages in apps #509
Conversation
ede34f5
to
ea780f2
Compare
That's normal for soundcloud. It happens since there there are no valid audio formats to play |
You could do that in another PR and not touch anything about streams here |
639ed9a
to
fc2734f
Compare
@Stypox Done. Code is ready for review. |
fc2734f
to
c20d35d
Compare
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.
Except from that one thing it looks good ;-)
...or/src/main/java/org/schabi/newpipe/extractor/exceptions/GeographicRestrictionException.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/exceptions/SoundCloudGoPlusException.java
Outdated
Show resolved
Hide resolved
@Stypox Changes requested applied. |
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.
Looks good, thank you! This will be merged after 0.20.9 is released
6742295
to
2956d8e
Compare
35e497c
to
d27b627
Compare
d27b627
to
716edef
Compare
716edef
to
646649a
Compare
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.
Looks good.
Can be merge once the conflict is solved.
@TobiGr Unfortunately, it doesn't work for some videos from type of https://www.youtube.com/watch?v=ayI2iBwGdxw (members-only content), so it shouldn't be merged until this is fixed. |
@TiA4f8R You could always do that in a later PR and let this one be merged. 4 out of 5 or 80% is pretty good, no? |
646649a
to
38a2927
Compare
@opusforlife2 You're right. Also, when I updated my PR, I added a check and if the reason message is null, NewPipe shows now the default |
Some tests fail, because the exceptions changed. Please fix them |
@TobiGr Done. Thanks to letting me know this because it would have broken the extraction of unexisiting YouTube videos. So it was not tests but my code. |
Hi, I was testing this out with the apk from Pull Request #5385 by @TiA4f8R (which implements these error messages) and I found another type of error that is not on this list - Restricted Mode errors... If YouTube's restricted mode is enabled in NewPipe and a "restricted" video is opened in the player then a generic "Content unavailable" message will be displayed. Someone who is unaware of this will think that there is an issue with the video extractor. There should be a way to detect this... Does anybody know how to do this? |
@rocketinventor That might need an exception. However, we detected that before, but after some refactoring, the detection does not work any more. Good catch! I suggest to do the following (@XiangRongLin, @B0pol, @Stypox any other ideas how to solve this?):
For later (maybe not in this PR): we should a add a And why the hell are the tests failing again -_- |
It's a SoundCloud intermittent test failure (the search test), so don't worry ;) |
@TiA4f8R would your method work for opening a video through a direct link, or only from within the app? Also, just to be clear, there are two levels of age restricted content (in YouTube) - each corresponding with thier own setting in NewPipe: Potentially Mature Content - Videos
Restricted (Mature) Content - Videos unblocked through the following opt-in:
If there is a way to detect one of these vs the other, then they should probably each have there own exceptions. If not, the error messages, at least, should be different (depending on which content restriction settings are in place from within NewPipe). I.e. If a video is blocked while "Restricted Mode" is on then the message maybe should suggest to disable "Restricted Mode" to see the video. |
I just tested this with the video URL for a "restricted" video from #4869 (same apk as before). The "This video is age restricted." error message definitely does work when "restricted mode" is off. |
5499df7
to
f62404d
Compare
…ewPipe Extractor to be able to display different error messages This commit adds two new exceptions in NewPipe Extractor: GeographicRestrictionException and SoundCloudGoPlusException (which extend to ContentNotAvailableException). These exceptions allow showing different error messages to user when a content isn't available in his/her/its country (only used for now by SoundCloudStreamExtractor) or when the content is a SoundCloud Go+ track.
These exceptions are thrown on a test with the error messages text, because YouTube returns only "UNPLAYABLE" status in most error cases. Tests are based with English strings, so changing the lang used by extractor will throw the generic exception (ContentNotAvailableException).
f62404d
to
e55284b
Compare
Also check if related streams are empty if they are expected to be empty.
The ContentNotSupportedException is thrown because no supported audio streams where extracted. However, SoundCLoud does not check, whether there are any streams available. This commit should be reverted in TeamNewPipe#526
AgeRestrictedException will be thrown only if the reason message equals to "Sign in to confirm your age" and if the age limit is 18.
Use final where possible in YoutubeStreamExtractor and do some other code style improvements
This PR add six new exceptions to be able to display different error messages in NewPipe when user tries to play an unplayable content. All of these exceptions extend the
ContentNotAvailableException
.AgeRestrictedContentException
, for age-restricted content which has no video or audio streams.GeographicRestrictionException
, for georestricted content (used for SoundCloud and YouTube georestricted videos, not working on YouTube Music georestricted tracks because YouTube shows "This video is not available")PaidContentException
, for paid content like YouTube movies or YouTube videos that require a channel subscriptionPrivateContentException
, for private YouTube videos (can be used for other services)SoundCloudGoPlusContentException
, for SoundCloud Go+ tracksYoutubeMusicPremiumContentException
, for YouTube videos restricted to YouTube Music Premium membersI carefully read the contribution guidelines and agree to them.
I have tested the API against NewPipe.
I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API. Better error messages for SoundCloud and YouTube unavailable contents NewPipe#5385