Include show name in episode download error
This commit is contained in:
parent
500f1532b5
commit
0b3d33878c
11
lib/nrk.ts
11
lib/nrk.ts
|
|
@ -1,6 +1,6 @@
|
|||
import { get, OK } from "https://deno.land/x/kall@v0.1.0/mod.ts";
|
||||
import {components as searchComponents} from './nrk-search.ts';
|
||||
import {components as catalogComponents} from './nrk-catalog.ts';
|
||||
import { components as searchComponents } from './nrk-search.ts';
|
||||
import { components as catalogComponents } from './nrk-catalog.ts';
|
||||
|
||||
|
||||
type ArrayElement<A> = A extends readonly (infer T)[] ? T : never
|
||||
|
|
@ -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};
|
||||
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 = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue