From 292e1030735e6860ba4599136f85337784c193ab Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 14 Mar 2021 17:51:47 +0100 Subject: [PATCH] Ignore ContentNotSupportedException caused by Bandcamp fan pages --- .../fragments/detail/VideoDetailFragment.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 08ec9a5fc..5581cf875 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -62,6 +62,7 @@ import org.schabi.newpipe.error.ReCaptchaActivity; import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.NewPipe; +import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.stream.AudioStream; import org.schabi.newpipe.extractor.stream.Stream; @@ -1547,8 +1548,19 @@ public final class VideoDetailFragment } if (!info.getErrors().isEmpty()) { - showSnackBarError(new ErrorInfo(info.getErrors(), - UserAction.REQUESTED_STREAM, info.getUrl(), info)); + // Bandcamp fan pages are not yet supported and thus a ContentNotAvailableException is + // thrown. This is not an error and thus should not be shown to the user. + for (final Throwable throwable : info.getErrors()) { + if (throwable instanceof ContentNotSupportedException + && "Fan pages are not supported".equals(throwable.getMessage())) { + info.getErrors().remove(throwable); + } + } + + if (!info.getErrors().isEmpty()) { + showSnackBarError(new ErrorInfo(info.getErrors(), + UserAction.REQUESTED_STREAM, info.getUrl(), info)); + } } binding.detailControlsDownload.setVisibility(info.getStreamType() == StreamType.LIVE_STREAM