import { configs } from './config.ts' export default async function getPlaylistUrl (url: string): Promise { if (!url) throw new Error(`getPlaylistUrl requires a url, but it was undefined.`); const res = await fetch(`${configs.scoutUrl}/ytdlp/playlist-url?url=${url}`) if (!res.ok) { const body = await res.text() console.error(`failed to getPlaylistUrl res.status=${res.status}, res.statusText=${res.statusText}, body=${body}`) return null } else { const data = await res.json() as any console.log(`>>>>>> getPlaylistUrl got a data payload as follows`) console.log(data) if (!!data.error) { return null; } else { return data.data.url } } }