use JsonObject#isEmpty instead of JsonObject#equals(JsonUtils.EMPTY_OBJECT)
This commit is contained in:
parent
93e868634e
commit
5760366d70
|
@ -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.equals(JsonUtils.EMPTY_OBJECT)) {
|
||||
if (itemSectionRenderer.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -139,9 +139,9 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
|
|||
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
|
||||
.getObject("showingResultsForRenderer");
|
||||
|
||||
if (!didYouMeanRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
|
||||
if (!didYouMeanRenderer.isEmpty()) {
|
||||
return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
|
||||
} else if (!showingResultsForRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
|
||||
} else if (!showingResultsForRenderer.isEmpty()) {
|
||||
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.equals(JsonUtils.EMPTY_OBJECT)) {
|
||||
if (itemSectionRenderer.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
|
||||
.getObject("showingResultsForRenderer");
|
||||
return !showingResultsForRenderer.equals(JsonUtils.EMPTY_OBJECT);
|
||||
return !showingResultsForRenderer.isEmpty();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -73,7 +73,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
|
|||
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
|
||||
.getObject("showingResultsForRenderer");
|
||||
|
||||
if (!didYouMeanRenderer.equals(JsonUtils.EMPTY_OBJECT)) {
|
||||
if (!didYouMeanRenderer.isEmpty()) {
|
||||
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.equals(JsonUtils.EMPTY_OBJECT);
|
||||
return !showingResultsForRenderer.isEmpty();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
Loading…
Reference in New Issue