api/bluesky: use hls video cdn directly

This commit is contained in:
wukko 2024-11-16 21:57:14 +06:00
parent 09c66fead0
commit b61b8c82a2
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -3,9 +3,16 @@ import { cobaltUserAgent } from "../../config.js";
import { createStream } from "../../stream/manage.js"; import { createStream } from "../../stream/manage.js";
const extractVideo = async ({ media, filename, dispatcher }) => { const extractVideo = async ({ media, filename, dispatcher }) => {
const urlMasterHLS = media?.playlist; let urlMasterHLS = media?.playlist;
if (!urlMasterHLS) return { error: "fetch.empty" };
if (!urlMasterHLS.startsWith("https://video.bsky.app/")) return { error: "fetch.empty" }; 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 }) const masterHLS = await fetch(urlMasterHLS, { dispatcher })
.then(r => { .then(r => {