aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-01 13:25:42 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-01 13:26:45 +0100
commit7f0506de4f737807043cc70511dad55a1eada7de (patch)
tree4f20c4924621b8296801091e9264b0a2f8e39b90
parent6f27466738e0b170fe957793855ec96c187a34c9 (diff)
feat: extract more properties in stream and stream-item api handlers
-rw-r--r--src/backend/tubo/api.clj42
1 files changed, 26 insertions, 16 deletions
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]