[Youtube] add ytmusic linked playlist

This commit is contained in:
wispl 2024-08-04 19:46:51 -04:00
parent 6963385176
commit ec71642eff
1 changed files with 22 additions and 0 deletions

View File

@ -174,4 +174,26 @@ public class YoutubeMusicSongOrVideoInfoItemExtractor implements StreamInfoItemE
throw new ParsingException("Could not get thumbnails", e); throw new ParsingException("Could not get thumbnails", e);
} }
} }
@Nonnull
public String getPlaylist() {
if (searchType.equals(MUSIC_SONGS)) {
for (final Object item : descriptionElements) {
final JsonObject browseEndpoint = ((JsonObject) item)
.getObject("navigationEndpoint")
.getObject("browseEndpoint");
final String type = browseEndpoint
.getObject("browseEndpointContextSupportedConfigs")
.getObject("browseEndpointContextMusicConfig")
.getString("pageType");
if (type != null && type.equals("MUSIC_PAGE_TYPE_ALBUM")) {
return browseEndpoint.getString("browseId");
}
}
}
// handles singles, video, and others which may not belong in playlist
return "";
}
} }