adapt new nanojson version

This commit is contained in:
bopol 2020-05-05 10:02:56 +02:00
parent 79483a6dc0
commit 3757541a9c
4 changed files with 8 additions and 9 deletions

View File

@ -45,7 +45,7 @@ public class MediaCCCSearchExtractor extends SearchExtractor {
@Nonnull
@Override
public String getSearchSuggestion() throws ParsingException {
public String getSearchSuggestion() {
return "";
}

View File

@ -130,7 +130,7 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
public String getSearchSuggestion() throws ParsingException {
final JsonObject itemSectionRenderer = initialData.getObject("contents").getObject("sectionListRenderer")
.getArray("contents").getObject(0).getObject("itemSectionRenderer");
if (itemSectionRenderer == null) {
if (itemSectionRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
return "";
}
@ -139,9 +139,9 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
.getObject("showingResultsForRenderer");
if (didYouMeanRenderer != null) {
if (!didYouMeanRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
} else if (showingResultsForRenderer != null) {
} else if (!showingResultsForRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
return JsonUtils.getString(showingResultsForRenderer, "correctedQueryEndpoint.searchEndpoint.query");
} else {
return "";
@ -152,13 +152,13 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
public boolean isCorrectedSearch() {
final JsonObject itemSectionRenderer = initialData.getObject("contents").getObject("sectionListRenderer")
.getArray("contents").getObject(0).getObject("itemSectionRenderer");
if (itemSectionRenderer == null) {
if (itemSectionRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
return false;
}
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
.getObject("showingResultsForRenderer");
return showingResultsForRenderer != null;
return !showingResultsForRenderer.equals(JsonUtils.EMPTY_OBJECT);
}
@Nonnull

View File

@ -73,7 +73,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
.getObject("showingResultsForRenderer");
if (didYouMeanRenderer != null) {
if (!didYouMeanRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
return JsonUtils.getString(didYouMeanRenderer, "correctedQueryEndpoint.searchEndpoint.query");
} else if (showingResultsForRenderer != null) {
return getTextFromObject(showingResultsForRenderer.getObject("correctedQuery"));
@ -89,7 +89,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
.getObject("sectionListRenderer").getArray("contents").getObject(0)
.getObject("itemSectionRenderer").getArray("contents").getObject(0)
.getObject("showingResultsForRenderer");
return showingResultsForRenderer != null;
return !showingResultsForRenderer.equals(JsonUtils.EMPTY_OBJECT);
}
@Nonnull

View File

@ -7,7 +7,6 @@ import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.search.SearchExtractor;
import org.schabi.newpipe.extractor.services.DefaultSearchExtractorTest;