Merge pull request #490 from B0pol/peertube_related
[peertube] fix related streams api url when no tags
This commit is contained in:
commit
7e481cf81a
|
@ -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<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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue