Fix isCorrectedSearch test.

This commit is contained in:
FireMasterK 2021-07-31 02:18:18 +05:30
parent fd19c53f65
commit 88c11db4c5
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
1 changed files with 5 additions and 6 deletions

View File

@ -141,16 +141,15 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
}
@Override
public boolean isCorrectedSearch() {
final JsonObject itemSectionRenderer = initialData.getObject("contents").getObject("sectionListRenderer")
.getArray("contents").getObject(0).getObject("itemSectionRenderer");
public boolean isCorrectedSearch() throws ParsingException {
final JsonObject itemSectionRenderer = JsonUtils.getArray(JsonUtils.getArray(initialData, "contents.tabbedSearchResultsRenderer.tabs").getObject(0), "tabRenderer.content.sectionListRenderer.contents").getObject(0).getObject("itemSectionRenderer");
if (itemSectionRenderer.isEmpty()) {
return false;
}
final JsonObject showingResultsForRenderer = itemSectionRenderer.getArray("contents").getObject(0)
.getObject("showingResultsForRenderer");
return !showingResultsForRenderer.isEmpty();
final boolean corrected = itemSectionRenderer.getArray("contents").getObject(0)
.has("didYouMeanRenderer");
return corrected;
}
@Nonnull