-
Notifications
You must be signed in to change notification settings - Fork 425
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 AccountTerminatedException for terminated channels #580
Conversation
3abbdea
to
f1a1591
Compare
I could not find more info on deleted and terminated channels in the docs of the other services. |
...src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java
Outdated
Show resolved
Hide resolved
assertEquals(e.getMessage(), | ||
"This account has been terminated for a violation of YouTube's Terms of Service."); |
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 would remove the assertions for the error message. They are bound to fail very soon, if they change the wording. Only usecase i can think of for them, is directly displaying them to the end-user in which case, the exact wording does not change the correctness of the implementation.
if (alertText != null && alertText.contains("This account has been terminated")) { | ||
if (alertText.contains("violation") || alertText.contains("violating") | ||
|| alertText.contains("infringement")) { |
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.
what happens if the localization is changed to non-english. I would assume the error messages are localized
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.
@XiangRongLin Yes, they are, it's the same thing for the error messages from YouTube videos.
I think in the future we need to implement something which stores strings of the error messages for each localization and compare with the value provided by YouTube in the language used for the extraction of YouTube datas.
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.
LGTM
Oh wait, this has to be addressed: |
Adds a new
ContentNotAvailableException
:AccountTerminatedException
to distinguish between terminated channels. The fieldreason
provides more info on why the account has been terminated. This fixes a NPE when getting the feed for a terminated channel in YouTubeFeedExtractor.addCLOSED_BY_OWNER
reason (I need a dedicated channel for thisimplement in other services