Skip to content

Commit

Permalink
perf(gogocdn): Added null safety (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
Toasty360 authored Nov 20, 2024
1 parent 607f4d5 commit 79375b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/extractors/gogocdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GogoCDN extends VideoExtractor {
// console.log(decryptedData.track.tracks);
if (!decryptedData.source) throw new Error('No source found. Try a different server.');

const subtitles: ISubtitle[] = decryptedData.track.tracks.map((track: any) => ({
const subtitles: ISubtitle[] = decryptedData.track.tracks?.map((track: any) => ({
url: track.file,
lang: track.kind,
}));
Expand Down
10 changes: 0 additions & 10 deletions src/providers/movies/sflix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,5 @@ class SFlix extends MovieParser {
};
}

(async () => {
const movie = new SFlix();
console.time('recentTv');
// const search = await movie.fetchEpisodeSources("1167571","tv/free-vincenzo-hd-67955",StreamingServers.Voe);
const movieInfo = await movie.search('vincenzo');
// const recentTv = await movie.fetchTrendingMovies();
console.timeEnd('recentTv');
// const genre = await movie.fetchEpisodeServers("1167571","tv/free-vincenzo-hd-67955");
console.log(movieInfo);
})();

export default SFlix;
5 changes: 4 additions & 1 deletion test/anime/gogoanime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ test('returns a filled array of servers', async () => {
});

test('returns a filled object of episode sources', async () => {
const data = await gogoanime.fetchEpisodeSources('spy-x-family-episode-9', StreamingServers.StreamWish);
const data = await gogoanime.fetchEpisodeSources(
'arifureta-shokugyou-de-sekai-saikyou-season-3-episode-1',
StreamingServers.GogoCDN
);
expect(data.sources).not.toEqual([]);
expect(data.subtitles).not.toEqual([]);
});
Expand Down

0 comments on commit 79375b3

Please sign in to comment.