2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-22 09:57:38 +00:00

Merge pull request #1338 from Stypox/lockup-podcast

[YouTube] Support LOCKUP_CONTENT_TYPE_PODCAST
This commit is contained in:
Tobi 2025-07-16 09:14:33 -07:00 committed by GitHub
commit 68b4c9acba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 4 deletions

View File

@ -313,9 +313,14 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
.getArray("items"), channelVerifiedStatus, channelName, channelUrl); .getArray("items"), channelVerifiedStatus, channelName, channelUrl);
} else if (item.has("lockupViewModel")) { } else if (item.has("lockupViewModel")) {
final JsonObject lockupViewModel = item.getObject("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, commitPlaylistLockup(collector, lockupViewModel, channelVerifiedStatus,
channelName, channelUrl); channelName, channelUrl);
} else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) {
commitVideoLockup(collector, timeAgoParser, lockupViewModel, channelVerifiedStatus,
channelName, channelUrl);
} }
} else if (item.has("continuationItemRenderer")) { } else if (item.has("continuationItemRenderer")) {
return Optional.ofNullable(item.getObject("continuationItemRenderer")); return Optional.ofNullable(item.getObject("continuationItemRenderer"));
@ -372,6 +377,31 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
}); });
} }
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, private void commitPlaylistLockup(@Nonnull final MultiInfoItemsCollector collector,
@Nonnull final JsonObject playlistLockupViewModel, @Nonnull final JsonObject playlistLockupViewModel,
@Nonnull final VerifiedStatus channelVerifiedStatus, @Nonnull final VerifiedStatus channelVerifiedStatus,

View File

@ -247,10 +247,14 @@ public class YoutubeSearchExtractor extends SearchExtractor {
item.getObject("showRenderer"))); item.getObject("showRenderer")));
} else if (item.has("lockupViewModel")) { } else if (item.has("lockupViewModel")) {
final JsonObject lockupViewModel = item.getObject("lockupViewModel"); final JsonObject lockupViewModel = item.getObject("lockupViewModel");
if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals( final String contentType = lockupViewModel.getString("contentType");
lockupViewModel.getString("contentType"))) { if ("LOCKUP_CONTENT_TYPE_PLAYLIST".equals(contentType)
|| "LOCKUP_CONTENT_TYPE_PODCAST".equals(contentType)) {
collector.commit( collector.commit(
new YoutubeMixOrPlaylistLockupInfoItemExtractor(lockupViewModel)); new YoutubeMixOrPlaylistLockupInfoItemExtractor(lockupViewModel));
} else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) {
collector.commit(new YoutubeStreamInfoItemLockupExtractor(
lockupViewModel, timeAgoParser));
} }
} }
} }

View File

@ -760,7 +760,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
} else if (result.has("lockupViewModel")) { } else if (result.has("lockupViewModel")) {
final JsonObject lockupViewModel = result.getObject("lockupViewModel"); final JsonObject lockupViewModel = result.getObject("lockupViewModel");
final String contentType = lockupViewModel.getString("contentType"); 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( return new YoutubeMixOrPlaylistLockupInfoItemExtractor(
lockupViewModel); lockupViewModel);
} else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) { } else if ("LOCKUP_CONTENT_TYPE_VIDEO".equals(contentType)) {