Skip to content

Commit

Permalink
[peertube] fix related streams api url when no tags
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol committed Dec 19, 2020
1 parent 22a4151 commit 8d34365
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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;
Expand All @@ -30,6 +29,8 @@
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;
Expand All @@ -38,9 +39,6 @@
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;
Expand Down Expand Up @@ -269,7 +267,9 @@ public StreamInfoItemsCollector getRelatedStreams() throws IOException, Extracti
final List<String> 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);
}
Expand Down

0 comments on commit 8d34365

Please sign in to comment.