Skip to content

Commit e475b29

Browse files
Isira-Seneviratnelitetex
authored andcommitted
Restore URL check
1 parent 0352659 commit e475b29

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSubscriptionExtractor.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.ArrayList;
1919
import java.util.Collections;
2020
import java.util.List;
21+
import java.util.Objects;
2122
import java.util.stream.Collectors;
2223
import java.util.zip.ZipEntry;
2324
import java.util.zip.ZipInputStream;
@@ -148,11 +149,15 @@ public List<SubscriptionItem> fromCsvInputStream(@Nonnull final InputStream cont
148149
.map(values -> {
149150
// Channel URL from second entry
150151
final String channelUrl = values[1].replace("http://", "https://");
151-
// Channel title from third entry
152-
final String title = values[2];
153-
154-
return new SubscriptionItem(service.getServiceId(), channelUrl, title);
152+
if (!channelUrl.startsWith(BASE_CHANNEL_URL)) {
153+
return null;
154+
} else {
155+
// Channel title from third entry
156+
final String title = values[2];
157+
return new SubscriptionItem(service.getServiceId(), channelUrl, title);
158+
}
155159
})
160+
.filter(Objects::nonNull)
156161
.collect(Collectors.toUnmodifiableList());
157162
} catch (final UncheckedIOException | IOException e) {
158163
throw new InvalidSourceException("Error reading CSV file", e);

0 commit comments

Comments
 (0)