Include show name in episode download error

This commit is contained in:
olaven 2023-03-11 12:17:04 +01:00
parent 500f1532b5
commit 0b3d33878c
1 changed files with 8 additions and 5 deletions

View File

@ -28,10 +28,11 @@ interface Manifest {
async function withDownloadLink(episode: OriginalEpisode): Promise<Episode> {
// getting stream link
const [playbackStatus, playbackResponse] = await get<Manifest>(`https://psapi.nrk.no/playback/manifest/podcast/${episode.episodeId}`)
if (playbackStatus === OK && playbackResponse) {
return { ...episode, url: playbackResponse.playable.assets[0].url };
} else {
throw `Error getting downloadLink for ${episode.episodeId}`
throw `Error getting downloadLink for ${episode.episodeId}, serie: ${episode.originalTitle}`
}
}
@ -69,3 +70,5 @@ export const nrkRadio = {
}
}