Skip to content

Commit b747c0f

Browse files
Stypoxwhistlingwoods
authored andcommitted
Code style
1 parent f0cf33c commit b747c0f

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicAlbumOrPlaylistInfoItemExtractor.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ public YoutubeMusicAlbumOrPlaylistInfoItemExtractor(final JsonObject albumOrPlay
2626
final String searchType) {
2727
this.albumOrPlaylistInfoItem = albumOrPlaylistInfoItem;
2828

29-
if (searchType.equals(MUSIC_ALBUMS)) {
30-
// "Album", " • ", uploader, " • ", year
31-
this.descriptionElementUploader = descriptionElements.getObject(2);
32-
} else {
33-
// uploader, " • ", view count
34-
this.descriptionElementUploader = descriptionElements.getObject(0);
35-
}
29+
this.descriptionElementUploader = descriptionElements.getObject(
30+
// For albums: "Album/Single/EP", " • ", uploader, " • ", year -> uploader is at 2
31+
// For playlists: uploader, " • ", view count -> uploader is at 0
32+
MUSIC_ALBUMS.equals(searchType) ? 2 : 0
33+
);
3634
}
3735

3836
@Nonnull
@@ -122,14 +120,13 @@ public String getUploaderUrl() throws ParsingException {
122120
}
123121

124122
// then try obtaining it from the uploader description element
125-
if (descriptionElementUploader.has("navigationEndpoint")) {
126-
return getUrlFromNavigationEndpoint(
127-
descriptionElementUploader.getObject("navigationEndpoint"));
128-
} else {
123+
if (!descriptionElementUploader.has("navigationEndpoint")) {
129124
// if there is no navigationEndpoint for the uploader
130125
// then this playlist/album is likely autogenerated
131126
return null;
132127
}
128+
return getUrlFromNavigationEndpoint(
129+
descriptionElementUploader.getObject("navigationEndpoint"));
133130
}
134131

135132
@Override

0 commit comments

Comments
 (0)