Apply requested changes
This commit is contained in:
parent
35e082248e
commit
c7757c0994
|
@ -127,11 +127,13 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
|
|||
new StreamInfoItemsCollector(getServiceId());
|
||||
final List<String> ids = new ArrayList<>();
|
||||
|
||||
final JsonArray tracks = playlist.getArray("tracks");
|
||||
tracks.stream().filter(JsonObject.class::isInstance)
|
||||
playlist.getArray("tracks")
|
||||
.stream()
|
||||
.filter(JsonObject.class::isInstance)
|
||||
.map(JsonObject.class::cast)
|
||||
.forEachOrdered(track -> {
|
||||
if (track.has("title")) { // i.e. if full info is available
|
||||
// i.e. if full info is available
|
||||
if (track.has("title")) {
|
||||
streamInfoItemsCollector.commit(
|
||||
new SoundcloudStreamInfoItemExtractor(track));
|
||||
} else {
|
||||
|
|
|
@ -224,8 +224,8 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor {
|
|||
|
||||
streams.stream()
|
||||
.filter(JsonObject.class::isInstance)
|
||||
.map(stream -> ((JsonObject) stream)
|
||||
.getObject("playlistPanelVideoRenderer"))
|
||||
.map(JsonObject.class::cast)
|
||||
.map(stream -> stream.getObject("playlistPanelVideoRenderer"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(streamInfo -> new YoutubeStreamInfoItemExtractor(streamInfo, timeAgoParser))
|
||||
.forEachOrdered(collector::commit);
|
||||
|
|
|
@ -236,6 +236,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
|
|||
.getArray("contents");
|
||||
|
||||
final JsonObject videoPlaylistObject = contents.stream()
|
||||
.filter(JsonObject.class::isInstance)
|
||||
.map(JsonObject.class::cast)
|
||||
.map(content -> content.getObject("itemSectionRenderer")
|
||||
.getArray("contents")
|
||||
|
@ -316,9 +317,11 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
|
|||
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
||||
|
||||
videos.stream()
|
||||
.filter(video -> ((JsonObject) video).has(PLAYLIST_VIDEO_RENDERER))
|
||||
.map(video -> new YoutubeStreamInfoItemExtractor(((JsonObject) video)
|
||||
.getObject(PLAYLIST_VIDEO_RENDERER), timeAgoParser) {
|
||||
.filter(JsonObject.class::isInstance)
|
||||
.map(JsonObject.class::cast)
|
||||
.filter(video -> video.has(PLAYLIST_VIDEO_RENDERER))
|
||||
.map(video -> new YoutubeStreamInfoItemExtractor(
|
||||
video.getObject(PLAYLIST_VIDEO_RENDERER), timeAgoParser) {
|
||||
@Override
|
||||
public long getViewCount() {
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue