Remove unnecessary collector creation function from search extractor
This commit is contained in:
parent
04bfa0ec6a
commit
c921e5d6a5
|
@ -52,7 +52,7 @@ public class InfoItemsSearchCollector extends InfoItemsCollector<InfoItem, InfoI
|
||||||
private final ChannelInfoItemsCollector userCollector;
|
private final ChannelInfoItemsCollector userCollector;
|
||||||
private final PlaylistInfoItemsCollector playlistCollector;
|
private final PlaylistInfoItemsCollector playlistCollector;
|
||||||
|
|
||||||
InfoItemsSearchCollector(int serviceId) {
|
public InfoItemsSearchCollector(int serviceId) {
|
||||||
super(serviceId);
|
super(serviceId);
|
||||||
streamCollector = new StreamInfoItemsCollector(serviceId);
|
streamCollector = new StreamInfoItemsCollector(serviceId);
|
||||||
userCollector = new ChannelInfoItemsCollector(serviceId);
|
userCollector = new ChannelInfoItemsCollector(serviceId);
|
||||||
|
|
|
@ -27,10 +27,6 @@ public abstract class SearchExtractor extends ListExtractor<InfoItem> {
|
||||||
|
|
||||||
public abstract String getSearchSuggestion() throws ParsingException;
|
public abstract String getSearchSuggestion() throws ParsingException;
|
||||||
|
|
||||||
protected InfoItemsSearchCollector getInfoItemSearchCollector() {
|
|
||||||
return new InfoItemsSearchCollector(getService().getServiceId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SearchQueryHandler getLinkHandler() {
|
public SearchQueryHandler getLinkHandler() {
|
||||||
return (SearchQueryHandler) super.getLinkHandler();
|
return (SearchQueryHandler) super.getLinkHandler();
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class MediaCCCSearchExtractor extends SearchExtractor {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionException {
|
public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionException {
|
||||||
final InfoItemsSearchCollector searchItems = getInfoItemSearchCollector();
|
final InfoItemsSearchCollector searchItems = new InfoItemsSearchCollector(getServiceId());
|
||||||
|
|
||||||
if (getLinkHandler().getContentFilters().contains(CONFERENCES)
|
if (getLinkHandler().getContentFilters().contains(CONFERENCES)
|
||||||
|| getLinkHandler().getContentFilters().contains(ALL)
|
|| getLinkHandler().getContentFilters().contains(ALL)
|
||||||
|
|
|
@ -47,8 +47,7 @@ public class PeertubeSearchExtractor extends SearchExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private InfoItemsCollector<InfoItem, InfoItemExtractor> collectStreamsFrom(JsonObject json) throws ParsingException {
|
private InfoItemsCollector<InfoItem, InfoItemExtractor> collectStreamsFrom(JsonObject json) throws ParsingException {
|
||||||
|
final InfoItemsSearchCollector collector = new InfoItemsSearchCollector(getServiceId());
|
||||||
final InfoItemsSearchCollector collector = getInfoItemSearchCollector();
|
|
||||||
|
|
||||||
JsonArray contents;
|
JsonArray contents;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class SoundcloudSearchExtractor extends SearchExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private InfoItemsCollector<InfoItem, InfoItemExtractor> collectItems(JsonArray searchCollection) {
|
private InfoItemsCollector<InfoItem, InfoItemExtractor> collectItems(JsonArray searchCollection) {
|
||||||
final InfoItemsSearchCollector collector = getInfoItemSearchCollector();
|
final InfoItemsSearchCollector collector = new InfoItemsSearchCollector(getServiceId());
|
||||||
|
|
||||||
for (Object result : searchCollection) {
|
for (Object result : searchCollection) {
|
||||||
if (!(result instanceof JsonObject)) continue;
|
if (!(result instanceof JsonObject)) continue;
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public InfoItemsPage<InfoItem> getInitialPage() throws ExtractionException {
|
public InfoItemsPage<InfoItem> getInitialPage() throws ExtractionException {
|
||||||
InfoItemsSearchCollector collector = getInfoItemSearchCollector();
|
final InfoItemsSearchCollector collector = new InfoItemsSearchCollector(getServiceId());
|
||||||
JsonArray sections = initialData.getObject("contents").getObject("twoColumnSearchResultsRenderer")
|
JsonArray sections = initialData.getObject("contents").getObject("twoColumnSearchResultsRenderer")
|
||||||
.getObject("primaryContents").getObject("sectionListRenderer").getArray("contents");
|
.getObject("primaryContents").getObject("sectionListRenderer").getArray("contents");
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
|
||||||
throw new ExtractionException(new IllegalArgumentException("Page url is empty or null"));
|
throw new ExtractionException(new IllegalArgumentException("Page url is empty or null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoItemsSearchCollector collector = getInfoItemSearchCollector();
|
final InfoItemsSearchCollector collector = new InfoItemsSearchCollector(getServiceId());
|
||||||
final JsonArray ajaxJson = getJsonResponse(pageUrl, getExtractorLocalization());
|
final JsonArray ajaxJson = getJsonResponse(pageUrl, getExtractorLocalization());
|
||||||
|
|
||||||
JsonObject itemSectionRenderer = ajaxJson.getObject(1).getObject("response")
|
JsonObject itemSectionRenderer = ajaxJson.getObject(1).getObject("response")
|
||||||
|
|
Loading…
Reference in New Issue