mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-04-29 16:30:29 +05:30
Add itags to the streams api.
This commit is contained in:
parent
5d316597e7
commit
9fd20dd7b1
@ -214,7 +214,7 @@ public class StreamHandlers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lbryURL != null)
|
if (lbryURL != null)
|
||||||
streams.videoStreams.add(0, new PipedStream(lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
|
streams.videoStreams.add(0, new PipedStream(-1, lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
|
||||||
|
|
||||||
// Attempt to get dislikes calculating with the RYD API rating
|
// Attempt to get dislikes calculating with the RYD API rating
|
||||||
if (streams.dislikes < 0 && streams.likes >= 0) {
|
if (streams.dislikes < 0 && streams.likes >= 0) {
|
||||||
@ -260,10 +260,10 @@ public class StreamHandlers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lbryHlsURL != null)
|
if (lbryHlsURL != null)
|
||||||
streams.videoStreams.add(0, new PipedStream(lbryHlsURL, "HLS", "LBRY HLS", "application/x-mpegurl", false, -1));
|
streams.videoStreams.add(0, new PipedStream(-1, lbryHlsURL, "HLS", "LBRY HLS", "application/x-mpegurl", false, -1));
|
||||||
|
|
||||||
if (lbryURL != null)
|
if (lbryURL != null)
|
||||||
streams.videoStreams.add(0, new PipedStream(lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
|
streams.videoStreams.add(0, new PipedStream(-1, lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
|
||||||
|
|
||||||
long time = info.getUploadDate() != null ? info.getUploadDate().offsetDateTime().toInstant().toEpochMilli()
|
long time = info.getUploadDate() != null ? info.getUploadDate().offsetDateTime().toInstant().toEpochMilli()
|
||||||
: System.currentTimeMillis();
|
: System.currentTimeMillis();
|
||||||
|
@ -45,17 +45,17 @@ public class CollectionUtils {
|
|||||||
boolean livestream = info.getStreamType() == StreamType.LIVE_STREAM;
|
boolean livestream = info.getStreamType() == StreamType.LIVE_STREAM;
|
||||||
|
|
||||||
if (!livestream) {
|
if (!livestream) {
|
||||||
info.getVideoOnlyStreams().forEach(stream -> videoStreams.add(new PipedStream(rewriteVideoURL(stream.getContent()),
|
info.getVideoOnlyStreams().forEach(stream -> videoStreams.add(new PipedStream(stream.getItag(), rewriteVideoURL(stream.getContent()),
|
||||||
String.valueOf(stream.getFormat()), stream.getResolution(), stream.getFormat().getMimeType(), true,
|
String.valueOf(stream.getFormat()), stream.getResolution(), stream.getFormat().getMimeType(), true,
|
||||||
stream.getBitrate(), stream.getInitStart(), stream.getInitEnd(), stream.getIndexStart(),
|
stream.getBitrate(), stream.getInitStart(), stream.getInitEnd(), stream.getIndexStart(),
|
||||||
stream.getIndexEnd(), stream.getCodec(), stream.getWidth(), stream.getHeight(), stream.getFps(), stream.getItagItem().getContentLength())));
|
stream.getIndexEnd(), stream.getCodec(), stream.getWidth(), stream.getHeight(), stream.getFps(), stream.getItagItem().getContentLength())));
|
||||||
info.getVideoStreams()
|
info.getVideoStreams()
|
||||||
.forEach(stream -> videoStreams
|
.forEach(stream -> videoStreams
|
||||||
.add(new PipedStream(rewriteVideoURL(stream.getContent()), String.valueOf(stream.getFormat()),
|
.add(new PipedStream(stream.getItag(), rewriteVideoURL(stream.getContent()), String.valueOf(stream.getFormat()),
|
||||||
stream.getResolution(), stream.getFormat().getMimeType(), false, stream.getItagItem().getContentLength())));
|
stream.getResolution(), stream.getFormat().getMimeType(), false, stream.getItagItem().getContentLength())));
|
||||||
|
|
||||||
info.getAudioStreams()
|
info.getAudioStreams()
|
||||||
.forEach(stream -> audioStreams.add(new PipedStream(rewriteVideoURL(stream.getContent()),
|
.forEach(stream -> audioStreams.add(new PipedStream(stream.getItag(), rewriteVideoURL(stream.getContent()),
|
||||||
String.valueOf(stream.getFormat()), stream.getAverageBitrate() + " kbps",
|
String.valueOf(stream.getFormat()), stream.getAverageBitrate() + " kbps",
|
||||||
stream.getFormat().getMimeType(), false, stream.getBitrate(), stream.getInitStart(),
|
stream.getFormat().getMimeType(), false, stream.getBitrate(), stream.getInitStart(),
|
||||||
stream.getInitEnd(), stream.getIndexStart(), stream.getIndexEnd(), stream.getItagItem().getContentLength(), stream.getCodec(), stream.getAudioTrackId(),
|
stream.getInitEnd(), stream.getIndexStart(), stream.getIndexEnd(), stream.getItagItem().getContentLength(), stream.getCodec(), stream.getAudioTrackId(),
|
||||||
|
@ -8,11 +8,12 @@ public class PipedStream {
|
|||||||
public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName, audioTrackType, audioTrackLocale;
|
public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName, audioTrackType, audioTrackLocale;
|
||||||
public boolean videoOnly;
|
public boolean videoOnly;
|
||||||
|
|
||||||
public int bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps;
|
public int itag, bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps;
|
||||||
|
|
||||||
public long contentLength;
|
public long contentLength;
|
||||||
|
|
||||||
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, long contentLength) {
|
public PipedStream(int itag, String url, String format, String quality, String mimeType, boolean videoOnly, long contentLength) {
|
||||||
|
this.itag = itag;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.format = format;
|
this.format = format;
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
@ -21,9 +22,10 @@ public class PipedStream {
|
|||||||
this.contentLength = contentLength;
|
this.contentLength = contentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
|
public PipedStream(int itag, String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
|
||||||
int initStart, int initEnd, int indexStart, int indexEnd, long contentLength, String codec,
|
int initStart, int initEnd, int indexStart, int indexEnd, long contentLength, String codec,
|
||||||
String audioTrackId, String audioTrackName, String audioTrackType, String audioTrackLocale) {
|
String audioTrackId, String audioTrackName, String audioTrackType, String audioTrackLocale) {
|
||||||
|
this.itag = itag;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.format = format;
|
this.format = format;
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
@ -42,8 +44,9 @@ public class PipedStream {
|
|||||||
this.audioTrackLocale = audioTrackLocale;
|
this.audioTrackLocale = audioTrackLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
|
public PipedStream(int itag, String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
|
||||||
int initStart, int initEnd, int indexStart, int indexEnd, String codec, int width, int height, int fps, long contentLength) {
|
int initStart, int initEnd, int indexStart, int indexEnd, String codec, int width, int height, int fps, long contentLength) {
|
||||||
|
this.itag = itag;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.format = format;
|
this.format = format;
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user