mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-12-05 01:10:15 +00:00
[YouTube] Correctly handle unverified channels
This commit is contained in:
@@ -1599,9 +1599,13 @@ public final class YoutubeParsingHelper {
|
||||
@Nullable
|
||||
public static JsonObject getFirstCollaborator(final JsonObject navigationEndpoint)
|
||||
throws ParsingException {
|
||||
// CHECKSTYLE:OFF
|
||||
final JsonArray listItems = JsonUtils.getArray(navigationEndpoint, "showDialogCommand.panelLoadingStrategy.inlineContent.dialogViewModel.customContent.listViewModel.listItems");
|
||||
// CHECKSTYLE:ON
|
||||
return listItems.getObject(0).getObject("listItemViewModel");
|
||||
try {
|
||||
// CHECKSTYLE:OFF
|
||||
final JsonArray listItems = JsonUtils.getArray(navigationEndpoint, "showDialogCommand.panelLoadingStrategy.inlineContent.dialogViewModel.customContent.listViewModel.listItems");
|
||||
// CHECKSTYLE:ON
|
||||
return listItems.getObject(0).getObject("listItemViewModel");
|
||||
} catch (final ParsingException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,12 +550,15 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
.getArray("badges"));
|
||||
}
|
||||
|
||||
|
||||
final JsonObject channel = YoutubeParsingHelper.getFirstCollaborator(
|
||||
videoOwnerRenderer.getObject("navigationEndpoint"));
|
||||
if (channel == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return YoutubeParsingHelper.hasArtistOrVerifiedIconBadgeAttachment(
|
||||
YoutubeParsingHelper.getFirstCollaborator(videoOwnerRenderer
|
||||
.getObject("navigationEndpoint"))
|
||||
.getObject("title")
|
||||
.getArray("attachmentRuns")
|
||||
);
|
||||
channel.getObject("title").getArray("attachmentRuns"));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
Reference in New Issue
Block a user