Skip to content

Commit

Permalink
feat: extract more properties in stream and stream-item api handlers
Browse files Browse the repository at this point in the history
migalmoreno committed Dec 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6f27466 commit 7f0506d
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions src/backend/tubo/api.clj
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 7f0506d

Please sign in to comment.