From 7f0506de4f737807043cc70511dad55a1eada7de Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Sun, 1 Dec 2024 13:25:42 +0100 Subject: feat: extract more properties in stream and stream-item api handlers --- src/backend/tubo/api.clj | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'src/backend') diff --git a/src/backend/tubo/api.clj b/src/backend/tubo/api.clj index f5e1a2e..d0d33e2 100644 --- a/src/backend/tubo/api.clj +++ b/src/backend/tubo/api.clj @@ -14,22 +14,26 @@ (defn get-stream-item [stream] - {:type :stream - :service-id (.getServiceId stream) - :url (.getUrl stream) - :name (.getName stream) - :thumbnail-url (.getThumbnailUrl stream) - :uploader-name (.getUploaderName stream) - :uploader-url (.getUploaderUrl stream) - :uploader-avatar (.getUploaderAvatarUrl stream) - :upload-date (.getTextualUploadDate stream) + {:type :stream + :service-id (.getServiceId stream) + :url (.getUrl stream) + :name (.getName stream) + :thumbnail-url (.getThumbnailUrl stream) + :uploader-name (.getUploaderName stream) + :uploader-url (.getUploaderUrl stream) + :uploader-avatar (.getUploaderAvatarUrl stream) + :upload-date (.getTextualUploadDate stream) :short-description (.getShortDescription stream) - :duration (.getDuration stream) - :view-count (when-not (= (.getViewCount stream) -1) (.getViewCount stream)) - :uploaded - (when (.getUploadDate stream) - (.. stream (getUploadDate) (offsetDateTime) (toInstant) (toEpochMilli))) - :verified? (.isUploaderVerified stream)}) + :duration (.getDuration stream) + :view-count (when-not (= (.getViewCount stream) -1) + (.getViewCount stream)) + :uploaded (when (.getUploadDate stream) + (.. stream + (getUploadDate) + (offsetDateTime) + (toInstant) + (toEpochMilli))) + :verified? (.isUploaderVerified stream)}) (defn get-channel-item [channel] @@ -118,7 +122,13 @@ :audio-streams (j/from-java (.getAudioStreams info)) :video-streams (j/from-java (.getVideoStreams info)) :hls-url (.getHlsUrl info) - :dash-mpd-url (.getDashMpdUrl info)}))) + :dash-mpd-url (.getDashMpdUrl info) + :preview-frames (.getPreviewFrames info) + :stream-segments (.getStreamSegments info) + :support-info (.getSupportInfo info) + :short? (.isShortFormContent info) + :license (.getLicence info) + :subtitles (.getSubtitles info)}))) (defn get-playlist ([url] -- cgit v1.2.3