Skip to content

Commit 49a9cd0

Browse files
committed
feat: add uploaded timestamp to streams response
1 parent d67e50b commit 49a9cd0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/java/me/kavin/piped/utils/CollectionUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ public static Streams collectStreamInfo(StreamInfo info) {
7676
)));
7777

7878
return new Streams(info.getName(), info.getDescription().getContent(),
79-
info.getTextualUploadDate(), info.getUploaderName(), substringYouTube(info.getUploaderUrl()),
80-
getLastThumbnail(info.getUploaderAvatars()), getLastThumbnail(info.getThumbnails()), info.getDuration(),
81-
info.getViewCount(), info.getLikeCount(), info.getDislikeCount(), info.getUploaderSubscriberCount(), info.isUploaderVerified(),
79+
info.getTextualUploadDate(), info.getUploadDate() != null ? info.getUploadDate().offsetDateTime().toInstant().toEpochMilli() : -1,
80+
info.getUploaderName(), substringYouTube(info.getUploaderUrl()), getLastThumbnail(info.getUploaderAvatars()),
81+
getLastThumbnail(info.getThumbnails()), info.getDuration(), info.getViewCount(), info.getLikeCount(), info.getDislikeCount(),
82+
info.getUploaderSubscriberCount(), info.isUploaderVerified(),
8283
audioStreams, videoStreams, relatedStreams, subtitles, livestream, rewriteVideoURL(info.getHlsUrl(), Map.of()),
8384
rewriteVideoURL(info.getDashMpdUrl(), Map.of()), null, info.getCategory(), info.getLicence(),
8485
info.getPrivacy().name().toLowerCase(), info.getTags(), metaInfo, chapters, previewFrames);

src/main/java/me/kavin/piped/utils/obj/Streams.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Streams {
1717

1818
public boolean uploaderVerified;
1919

20-
public long duration, views, likes, dislikes, uploaderSubscriberCount;
20+
public long duration, views, likes, dislikes, uploaderSubscriberCount, uploaded;
2121

2222
public List<PipedStream> audioStreams, videoStreams;
2323

@@ -33,7 +33,7 @@ public class Streams {
3333

3434
public List<PreviewFrames> previewFrames;
3535

36-
public Streams(String title, String description, String uploadDate, String uploader, String uploaderUrl,
36+
public Streams(String title, String description, String uploadDate, long uploaded, String uploader, String uploaderUrl,
3737
String uploaderAvatar, String thumbnailUrl, long duration, long views, long likes, long dislikes, long uploaderSubscriberCount,
3838
boolean uploaderVerified, List<PipedStream> audioStreams, List<PipedStream> videoStreams,
3939
List<ContentItem> relatedStreams, List<Subtitle> subtitles, boolean livestream, String hls, String dash,
@@ -42,6 +42,7 @@ public Streams(String title, String description, String uploadDate, String uploa
4242
this.title = title;
4343
this.description = description;
4444
this.uploadDate = uploadDate;
45+
this.uploaded = uploaded;
4546
this.uploader = uploader;
4647
this.uploaderUrl = uploaderUrl;
4748
this.uploaderAvatar = uploaderAvatar;

0 commit comments

Comments
 (0)