From d72130edae12ff4a85ad18b9957adb8bdef68930 Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sat, 21 Mar 2020 02:27:31 -0300 Subject: [PATCH] Always return a new item collector in the search extractor --- .../org/schabi/newpipe/extractor/search/SearchExtractor.java | 5 +---- .../media_ccc/extractors/MediaCCCSearchExtractor.java | 3 +-- .../services/soundcloud/SoundcloudSearchExtractor.java | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java index 0acc640e6..8b900ab7c 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java @@ -17,11 +17,8 @@ public abstract class SearchExtractor extends ListExtractor { } } - private final InfoItemsSearchCollector collector; - public SearchExtractor(StreamingService service, SearchQueryHandler linkHandler) { super(service, linkHandler); - collector = new InfoItemsSearchCollector(service.getServiceId()); } public String getSearchString() { @@ -31,7 +28,7 @@ public abstract class SearchExtractor extends ListExtractor { public abstract String getSearchSuggestion() throws ParsingException; protected InfoItemsSearchCollector getInfoItemSearchCollector() { - return collector; + return new InfoItemsSearchCollector(getService().getServiceId()); } @Override diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java index 6d740337a..241d6d1e4 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java @@ -47,8 +47,7 @@ public class MediaCCCSearchExtractor extends SearchExtractor { @Nonnull @Override public InfoItemsPage getInitialPage() throws IOException, ExtractionException { - InfoItemsSearchCollector searchItems = getInfoItemSearchCollector(); - searchItems.reset(); + final InfoItemsSearchCollector searchItems = getInfoItemSearchCollector(); if (getLinkHandler().getContentFilters().contains(CONFERENCES) || getLinkHandler().getContentFilters().contains(ALL) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java index 42cd8ae0f..de02af6bb 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java @@ -79,7 +79,6 @@ public class SoundcloudSearchExtractor extends SearchExtractor { private InfoItemsCollector collectItems(JsonArray searchCollection) { final InfoItemsSearchCollector collector = getInfoItemSearchCollector(); - collector.reset(); for (Object result : searchCollection) { if (!(result instanceof JsonObject)) continue;