Removed unused methods

``contentFilters`` and ``sortfilter`` are get inside the ``ListLinkHandler`` and not the ``ListLinkHandlerFactory``
 ``ListLinkHandlerFactory`` only passes these values through when ``fromQuery`` is called
This commit is contained in:
litetex 2022-03-26 19:34:16 +01:00
parent ec5b54c38b
commit 33347ac18b
4 changed files with 11 additions and 23 deletions

View File

@ -1,5 +1,7 @@
package org.schabi.newpipe.extractor.linkhandler; package org.schabi.newpipe.extractor.linkhandler;
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -25,14 +27,12 @@ public class ListLinkHandler extends LinkHandler {
handler.sortFilter); handler.sortFilter);
} }
public ListLinkHandler(final LinkHandler handler, public ListLinkHandler(final LinkHandler handler) {
final List<String> contentFilters,
final String sortFilter) {
this(handler.originalUrl, this(handler.originalUrl,
handler.url, handler.url,
handler.id, handler.id,
contentFilters, Collections.emptyList(),
sortFilter); EMPTY_STRING);
} }
public List<String> getContentFilters() { public List<String> getContentFilters() {

View File

@ -13,16 +13,6 @@ public abstract class ListLinkHandlerFactory extends LinkHandlerFactory {
// To Override // To Override
/////////////////////////////////// ///////////////////////////////////
@SuppressWarnings({"RedundantThrows", "unused"})
public List<String> getContentFilter(final String url) throws ParsingException {
return Collections.emptyList();
}
@SuppressWarnings({"RedundantThrows", "unused"})
public String getSortFilter(final String url) throws ParsingException {
return "";
}
public abstract String getUrl(String id, List<String> contentFilter, String sortFilter) public abstract String getUrl(String id, List<String> contentFilter, String sortFilter)
throws ParsingException; throws ParsingException;
@ -50,18 +40,17 @@ public abstract class ListLinkHandlerFactory extends LinkHandlerFactory {
throw new IllegalArgumentException("url may not be null"); throw new IllegalArgumentException("url may not be null");
} }
return new ListLinkHandler(super.fromUrl(url, baseUrl), getContentFilter(url), return new ListLinkHandler(super.fromUrl(url, baseUrl));
getSortFilter(url));
} }
@Override @Override
public ListLinkHandler fromId(final String id) throws ParsingException { public ListLinkHandler fromId(final String id) throws ParsingException {
return new ListLinkHandler(super.fromId(id), new ArrayList<>(0), ""); return new ListLinkHandler(super.fromId(id));
} }
@Override @Override
public ListLinkHandler fromId(final String id, final String baseUrl) throws ParsingException { public ListLinkHandler fromId(final String id, final String baseUrl) throws ParsingException {
return new ListLinkHandler(super.fromId(id, baseUrl), new ArrayList<>(0), ""); return new ListLinkHandler(super.fromId(id, baseUrl));
} }
public ListLinkHandler fromQuery(final String id, public ListLinkHandler fromQuery(final String id,

View File

@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.linkhandler;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
@ -39,7 +40,7 @@ public abstract class SearchQueryHandlerFactory extends ListLinkHandlerFactory {
} }
public SearchQueryHandler fromQuery(final String query) throws ParsingException { public SearchQueryHandler fromQuery(final String query) throws ParsingException {
return fromQuery(query, new ArrayList<>(0), EMPTY_STRING); return fromQuery(query, Collections.emptyList(), EMPTY_STRING);
} }
/** /**

View File

@ -97,9 +97,7 @@ public final class YoutubePlaylistLinkHandlerFactory extends ListLinkHandlerFact
} }
final String newUrl = "https://www.youtube.com/watch?v=" + videoID final String newUrl = "https://www.youtube.com/watch?v=" + videoID
+ "&list=" + listID; + "&list=" + listID;
return new ListLinkHandler(new LinkHandler(url, newUrl, listID), return new ListLinkHandler(new LinkHandler(url, newUrl, listID));
getContentFilter(url),
getSortFilter(url));
} }
} catch (final MalformedURLException exception) { } catch (final MalformedURLException exception) {
throw new ParsingException("Error could not parse URL: " + exception.getMessage(), throw new ParsingException("Error could not parse URL: " + exception.getMessage(),