mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-13 13:50:33 +05:30
added torrent url in streams
This commit is contained in:
parent
b1a77fa484
commit
ef0ffb2229
@ -148,10 +148,11 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
||||
if(!(s instanceof JsonObject)) continue;
|
||||
JsonObject stream = (JsonObject) s;
|
||||
String url = JsonUtils.getString(stream, "fileUrl");
|
||||
String torrentUrl = JsonUtils.getString(stream, "torrentUrl");
|
||||
String resolution = JsonUtils.getString(stream, "resolution.label");
|
||||
String extension = url.substring(url.lastIndexOf(".") + 1);
|
||||
MediaFormat format = MediaFormat.getFromSuffix(extension);
|
||||
VideoStream videoStream = new VideoStream(url, format, resolution);
|
||||
VideoStream videoStream = new VideoStream(url, torrentUrl, format, resolution);
|
||||
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
|
||||
videoStreams.add(videoStream);
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package org.schabi.newpipe.extractor.stream;
|
||||
|
||||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
|
||||
public abstract class Stream implements Serializable {
|
||||
private final MediaFormat mediaFormat;
|
||||
public final String url;
|
||||
public final String torrentUrl;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getFormat()} or {@link #getFormatId()}
|
||||
@ -16,7 +17,12 @@ public abstract class Stream implements Serializable {
|
||||
public final int format;
|
||||
|
||||
public Stream(String url, MediaFormat format) {
|
||||
this(url, null, format);
|
||||
}
|
||||
|
||||
public Stream(String url, String torrentUrl, MediaFormat format) {
|
||||
this.url = url;
|
||||
this.torrentUrl = torrentUrl;
|
||||
this.format = format.id;
|
||||
this.mediaFormat = format;
|
||||
}
|
||||
|
@ -36,6 +36,16 @@ public class VideoStream extends Stream {
|
||||
this.resolution = resolution;
|
||||
this.isVideoOnly = isVideoOnly;
|
||||
}
|
||||
|
||||
public VideoStream(String url, String torrentUrl, MediaFormat format, String resolution) {
|
||||
this(url, torrentUrl, format, resolution, false);
|
||||
}
|
||||
|
||||
public VideoStream(String url, String torrentUrl, MediaFormat format, String resolution, boolean isVideoOnly) {
|
||||
super(url, torrentUrl, format);
|
||||
this.resolution = resolution;
|
||||
this.isVideoOnly = isVideoOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalStats(Stream cmp) {
|
||||
|
Loading…
Reference in New Issue
Block a user