From b61b8c82a20aebb1498f889fd467c80a48d16d63 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 16 Nov 2024 21:57:14 +0600 Subject: [PATCH] api/bluesky: use hls video cdn directly --- api/src/processing/services/bluesky.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/src/processing/services/bluesky.js b/api/src/processing/services/bluesky.js index 75ee8e6a..bc887437 100644 --- a/api/src/processing/services/bluesky.js +++ b/api/src/processing/services/bluesky.js @@ -3,9 +3,16 @@ import { cobaltUserAgent } from "../../config.js"; import { createStream } from "../../stream/manage.js"; const extractVideo = async ({ media, filename, dispatcher }) => { - const urlMasterHLS = media?.playlist; - if (!urlMasterHLS) return { error: "fetch.empty" }; - if (!urlMasterHLS.startsWith("https://video.bsky.app/")) return { error: "fetch.empty" }; + let urlMasterHLS = media?.playlist; + + if (!urlMasterHLS || !urlMasterHLS.startsWith("https://video.bsky.app/")) { + return { error: "fetch.empty" }; + } + + urlMasterHLS = urlMasterHLS.replace( + "video.bsky.app/watch/", + "video.cdn.bsky.app/hls/" + ); const masterHLS = await fetch(urlMasterHLS, { dispatcher }) .then(r => {