mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2025-08-22 09:57:38 +00:00
Add an UnsupportedContentInCountryException and use it in YouTube Charts
This allows client to distinguish of a generic ContentNotSupportedException, which hasn't fully its place for its usage in YouTube Charts.
This commit is contained in:
parent
25e30b745a
commit
2cccf48d6c
@ -0,0 +1,20 @@
|
|||||||
|
package org.schabi.newpipe.extractor.exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception for contents not supported in a country.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Unsupported content means content is not intentionally geographically restricted such as for
|
||||||
|
* distribution rights, for which {@link GeographicRestrictionException} should be used instead.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public class UnsupportedContentInCountryException extends ContentNotAvailableException {
|
||||||
|
|
||||||
|
public UnsupportedContentInCountryException(final String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnsupportedContentInCountryException(final String message, final Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,9 @@ package org.schabi.newpipe.extractor.services.youtube.extractors.kiosk;
|
|||||||
|
|
||||||
import org.schabi.newpipe.extractor.StreamingService;
|
import org.schabi.newpipe.extractor.StreamingService;
|
||||||
import org.schabi.newpipe.extractor.downloader.Downloader;
|
import org.schabi.newpipe.extractor.downloader.Downloader;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException;
|
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.UnsupportedContentInCountryException;
|
||||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -23,7 +23,7 @@ public class YoutubeTrendingMusicExtractor extends YoutubeChartsBaseKioskExtract
|
|||||||
throws IOException, ExtractionException {
|
throws IOException, ExtractionException {
|
||||||
if (!YT_CHARTS_SUPPORTED_COUNTRY_CODES.contains(
|
if (!YT_CHARTS_SUPPORTED_COUNTRY_CODES.contains(
|
||||||
getExtractorContentCountry().getCountryCode())) {
|
getExtractorContentCountry().getCountryCode())) {
|
||||||
throw new ContentNotSupportedException(
|
throw new UnsupportedContentInCountryException(
|
||||||
"YouTube Charts doesn't support this country for trending music videos charts");
|
"YouTube Charts doesn't support this country for trending music videos charts");
|
||||||
}
|
}
|
||||||
super.onFetchPage(downloader);
|
super.onFetchPage(downloader);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user