From 8d3436565fd5628f0b545b9b94f337bb9e7f6644 Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 19 Dec 2020 23:25:37 +0100 Subject: [PATCH] [peertube] fix related streams api url when no tags fixes #489 --- .../peertube/extractors/PeertubeStreamExtractor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java index 831bb10f..6345e5ac 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java @@ -4,7 +4,6 @@ import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; - import org.schabi.newpipe.extractor.MediaFormat; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; @@ -30,6 +29,8 @@ import org.schabi.newpipe.extractor.stream.VideoStream; import org.schabi.newpipe.extractor.utils.JsonUtils; import org.schabi.newpipe.extractor.utils.Utils; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -38,9 +39,6 @@ import java.util.Collections; import java.util.List; import java.util.Locale; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - public class PeertubeStreamExtractor extends StreamExtractor { private final String baseUrl; private JsonObject json; @@ -269,7 +267,9 @@ public class PeertubeStreamExtractor extends StreamExtractor { final List tags = getTags(); final String apiUrl; if (tags.isEmpty()) { - apiUrl = getUploaderUrl() + "/videos?start=0&count=8"; + apiUrl = baseUrl + "/api/v1/accounts/" + JsonUtils.getString(json, "account.name") + + "@" + JsonUtils.getString(json, "account.host") + + "/videos?start=0&count=8"; } else { apiUrl = getRelatedStreamsUrl(tags); }