From 49a9cd07fd431b4a934ed9f42d25c980ac0ade69 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 14 Jun 2024 22:52:44 +0200 Subject: [PATCH] feat: add uploaded timestamp to streams response --- src/main/java/me/kavin/piped/utils/CollectionUtils.java | 7 ++++--- src/main/java/me/kavin/piped/utils/obj/Streams.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/CollectionUtils.java b/src/main/java/me/kavin/piped/utils/CollectionUtils.java index ded6c24..97726c8 100644 --- a/src/main/java/me/kavin/piped/utils/CollectionUtils.java +++ b/src/main/java/me/kavin/piped/utils/CollectionUtils.java @@ -76,9 +76,10 @@ public class CollectionUtils { ))); return new Streams(info.getName(), info.getDescription().getContent(), - info.getTextualUploadDate(), info.getUploaderName(), substringYouTube(info.getUploaderUrl()), - getLastThumbnail(info.getUploaderAvatars()), getLastThumbnail(info.getThumbnails()), info.getDuration(), - info.getViewCount(), info.getLikeCount(), info.getDislikeCount(), info.getUploaderSubscriberCount(), info.isUploaderVerified(), + info.getTextualUploadDate(), info.getUploadDate() != null ? info.getUploadDate().offsetDateTime().toInstant().toEpochMilli() : -1, + info.getUploaderName(), substringYouTube(info.getUploaderUrl()), getLastThumbnail(info.getUploaderAvatars()), + getLastThumbnail(info.getThumbnails()), info.getDuration(), info.getViewCount(), info.getLikeCount(), info.getDislikeCount(), + info.getUploaderSubscriberCount(), info.isUploaderVerified(), audioStreams, videoStreams, relatedStreams, subtitles, livestream, rewriteVideoURL(info.getHlsUrl(), Map.of()), rewriteVideoURL(info.getDashMpdUrl(), Map.of()), null, info.getCategory(), info.getLicence(), info.getPrivacy().name().toLowerCase(), info.getTags(), metaInfo, chapters, previewFrames); diff --git a/src/main/java/me/kavin/piped/utils/obj/Streams.java b/src/main/java/me/kavin/piped/utils/obj/Streams.java index 478a37b..e0c2dd6 100644 --- a/src/main/java/me/kavin/piped/utils/obj/Streams.java +++ b/src/main/java/me/kavin/piped/utils/obj/Streams.java @@ -17,7 +17,7 @@ public class Streams { public boolean uploaderVerified; - public long duration, views, likes, dislikes, uploaderSubscriberCount; + public long duration, views, likes, dislikes, uploaderSubscriberCount, uploaded; public List audioStreams, videoStreams; @@ -33,7 +33,7 @@ public class Streams { public List previewFrames; - public Streams(String title, String description, String uploadDate, String uploader, String uploaderUrl, + public Streams(String title, String description, String uploadDate, long uploaded, String uploader, String uploaderUrl, String uploaderAvatar, String thumbnailUrl, long duration, long views, long likes, long dislikes, long uploaderSubscriberCount, boolean uploaderVerified, List audioStreams, List videoStreams, List relatedStreams, List subtitles, boolean livestream, String hls, String dash, @@ -42,6 +42,7 @@ public class Streams { this.title = title; this.description = description; this.uploadDate = uploadDate; + this.uploaded = uploaded; this.uploader = uploader; this.uploaderUrl = uploaderUrl; this.uploaderAvatar = uploaderAvatar;