Catch RegexException in subscriber count extractor
When the subscriber count extraction fails to find the Regex pattern, a RegexException is thrown. This is not a fatal error in most cases, for example when downloading the channel page in order to update the user's subscriptions, and so the correct behavior is to return UNKNOWN_SUBSCRIBER_COUNT. Related issue: https://github.com/TeamNewPipe/NewPipe/issues/11353. This bug comprises two issues: subscribers cannot be extracted for channels with pronoun tags, and when the RegexException is thrown, channel subscriptions will fail to update because the exception is uncaught. This commit fixes the latter aspect of the issue.
This commit is contained in:
parent
c343e31ed2
commit
1b3263c550
|
@ -43,6 +43,7 @@ import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelTabExtractor.VideosTabExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelTabExtractor.VideosTabExtractor;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelTabLinkHandlerFactory;
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelTabLinkHandlerFactory;
|
||||||
|
import org.schabi.newpipe.extractor.utils.Parser;
|
||||||
import org.schabi.newpipe.extractor.utils.Utils;
|
import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -304,6 +305,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||||
.getString(CONTENT));
|
.getString(CONTENT));
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
throw new ParsingException("Could not get subscriber count", e);
|
throw new ParsingException("Could not get subscriber count", e);
|
||||||
|
} catch (final Parser.RegexException e) {
|
||||||
|
return UNKNOWN_SUBSCRIBER_COUNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue