From 97955e5e41d8124a5e9f044058b0a4e9f17f989e Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Sun, 21 Jul 2024 23:35:57 +0200 Subject: [PATCH] [Bandcamp] Null-safe url catenation in track playlist Previously, if no URL was provided due to the track being a preorder or unpaid track that doesn't have its own public page, we would catenate the artist URL and null to a nonsensical string. This invalid URL would also be used to try fetching a thumbnail URL. The downstream behavior of the NewPipe client is only marginally improved, as it now no longer throws visible exceptions due to the missing thumbnails, but still gives an unfriendly error upon clicking the item that has a `null` URL. --- .../BandcampPlaylistStreamInfoItemExtractor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/streaminfoitem/BandcampPlaylistStreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/streaminfoitem/BandcampPlaylistStreamInfoItemExtractor.java index 5c37ec457..ac3861ac6 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/streaminfoitem/BandcampPlaylistStreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/streaminfoitem/BandcampPlaylistStreamInfoItemExtractor.java @@ -43,7 +43,12 @@ public class BandcampPlaylistStreamInfoItemExtractor extends BandcampStreamInfoI @Override public String getUrl() { - return getUploaderUrl() + track.getString("title_link"); + final String relativeUrl = track.getString("title_link"); + if (relativeUrl != null) { + return getUploaderUrl() + relativeUrl; + } else { + return null; + } } @Override @@ -66,7 +71,7 @@ public class BandcampPlaylistStreamInfoItemExtractor extends BandcampStreamInfoI @Nonnull @Override public List getThumbnails() throws ParsingException { - if (substituteCovers.isEmpty()) { + if (substituteCovers.isEmpty() && getUrl() != null) { try { final StreamExtractor extractor = service.getStreamExtractor(getUrl()); extractor.fetchPage();