Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,14 @@ private Optional<JsonObject> collectItem(@Nonnull final MultiInfoItemsCollector
.getArray("items"), channelVerifiedStatus, channelName, channelUrl);
} else if (item.has("lockupViewModel")) {
final JsonObject lockupViewModel = item.getObject("lockupViewModel");
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(lockupViewModel.getString("contentType"))) {
final String contentType = lockupViewModel.getString("contentType");
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(contentType)
|| "LOCKUP_CONTENT_TYPE_PODCAST".equals(contentType)) {
commitPlaylistLockup(collector, lockupViewModel, channelVerifiedStatus,
channelName, channelUrl);
} else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) {
commitVideoLockup(collector, timeAgoParser, lockupViewModel, channelVerifiedStatus,
channelName, channelUrl);
}
} else if (item.has("continuationItemRenderer")) {
return Optional.ofNullable(item.getObject("continuationItemRenderer"));
Expand Down Expand Up @@ -372,6 +377,31 @@ public boolean isUploaderVerified() {
});
}

private static void commitVideoLockup(@Nonnull final MultiInfoItemsCollector collector,
@Nonnull final TimeAgoParser timeAgoParser,
@Nonnull final JsonObject lockupViewModel,
@Nonnull final VerifiedStatus channelVerifiedStatus,
@Nullable final String channelName,
@Nullable final String channelUrl) {
collector.commit(
new YoutubeStreamInfoItemLockupExtractor(lockupViewModel, timeAgoParser) {
@Override
public String getUploaderName() throws ParsingException {
return isNullOrEmpty(channelName) ? super.getUploaderName() : channelName;
}

@Override
public String getUploaderUrl() throws ParsingException {
return isNullOrEmpty(channelUrl) ? super.getUploaderName() : channelUrl;
}

@Override
public boolean isUploaderVerified() {
return channelVerifiedStatus == VerifiedStatus.VERIFIED;
}
});
}

private void commitPlaylistLockup(@Nonnull final MultiInfoItemsCollector collector,
@Nonnull final JsonObject playlistLockupViewModel,
@Nonnull final VerifiedStatus channelVerifiedStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,14 @@ private void collectStreamsFrom(final MultiInfoItemsCollector collector,
item.getObject("showRenderer")));
} else if (item.has("lockupViewModel")) {
final JsonObject lockupViewModel = item.getObject("lockupViewModel");
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(
lockupViewModel.getString("contentType"))) {
final String contentType = lockupViewModel.getString("contentType");
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(contentType)
|| "LOCKUP_CONTENT_TYPE_PODCAST".equals(contentType)) {
collector.commit(
new YoutubeMixOrPlaylistLockupInfoItemExtractor(lockupViewModel));
} else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) {
collector.commit(new YoutubeStreamInfoItemLockupExtractor(
lockupViewModel, timeAgoParser));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,8 @@ public MultiInfoItemsCollector getRelatedItems() throws ExtractionException {
} else if (result.has("lockupViewModel")) {
final JsonObject lockupViewModel = result.getObject("lockupViewModel");
final String contentType = lockupViewModel.getString("contentType");
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(contentType)) {
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(contentType)
|| "LOCKUP_CONTENT_TYPE_PODCAST".equals(contentType)) {
return new YoutubeMixOrPlaylistLockupInfoItemExtractor(
lockupViewModel);
} else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) {
Expand Down
Loading