2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-31 06:15:37 +00:00

Fix issue when there is no didYouMeanRenderer in itemSectionRenderer

This commit is contained in:
wb9688
2020-03-21 20:11:06 +01:00
parent 5a775a4bbe
commit dd434cca01

View File

@@ -176,8 +176,10 @@ public class YoutubeSearchExtractor extends SearchExtractor {
final JsonObject itemSectionRenderer = initialData.getObject("contents").getObject("sectionListRenderer")
.getArray("contents").getObject(0).getObject("itemSectionRenderer");
if (itemSectionRenderer == null) return "";
return getTextFromObject(itemSectionRenderer.getArray("contents").getObject(0)
.getObject("didYouMeanRenderer").getObject("correctedQuery"));
final JsonObject didYouMeanRenderer = itemSectionRenderer.getArray("contents")
.getObject(0).getObject("didYouMeanRenderer");
if (didYouMeanRenderer == null) return "";
return getTextFromObject(didYouMeanRenderer.getObject("correctedQuery"));
} else {
JsonObject showingResultsForRenderer = initialData.getObject("contents")
.getObject("twoColumnSearchResultsRenderer").getObject("primaryContents")