Skip to content

Commit

Permalink
fix: need to include fetch as we build for node 16 today
Browse files Browse the repository at this point in the history
  • Loading branch information
birme committed Jan 4, 2024
1 parent 19321d3 commit c9f132d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
SubtitleTracks
} from 'eyevinn-channel-engine';
import { Language, StitchPayload } from './interface';
import fetch from 'node-fetch';

import { uuid } from 'uuidv4';

Expand Down Expand Up @@ -261,10 +262,14 @@ export function getVodUrlWithPreroll(
}

export async function resolveRedirect(url: string) {
const response = await fetch(url);
if (response.redirected) {
console.log('Redirect: ' + response.url);
return response.url || url;
try {
const response = await fetch(url);
if (response.redirected) {
console.log('Redirect: ' + response.url);
return response.url || url;
}
} catch (err) {
console.error(err);
}
return url;
}

0 comments on commit c9f132d

Please # to comment.