From 4869ab1feec3758c3124562c00ee8884597e96a6 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sat, 7 Dec 2024 11:15:01 +0530 Subject: [PATCH] Restore URL check --- .../extractors/YoutubeSubscriptionExtractor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSubscriptionExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSubscriptionExtractor.java index 7293a37d5..f07b1047c 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSubscriptionExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSubscriptionExtractor.java @@ -18,6 +18,7 @@ import java.io.UncheckedIOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -148,11 +149,15 @@ public class YoutubeSubscriptionExtractor extends SubscriptionExtractor { .map(values -> { // Channel URL from second entry final String channelUrl = values[1].replace("http://", "https://"); - // Channel title from third entry - final String title = values[2]; - - return new SubscriptionItem(service.getServiceId(), channelUrl, title); + if (!channelUrl.startsWith(BASE_CHANNEL_URL)) { + return null; + } else { + // Channel title from third entry + final String title = values[2]; + return new SubscriptionItem(service.getServiceId(), channelUrl, title); + } }) + .filter(Objects::nonNull) .collect(Collectors.toUnmodifiableList()); } catch (final UncheckedIOException | IOException e) { throw new InvalidSourceException("Error reading CSV file", e);