From 9797d7450c35341657391667e3091f72886e24cf Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 16 Dec 2020 22:53:25 -0500 Subject: [PATCH] Fix issues caused by YouTube API upgrade --- src/utils/youtubeApi.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/youtubeApi.ts b/src/utils/youtubeApi.ts index 212b6f1..690bfbc 100644 --- a/src/utils/youtubeApi.ts +++ b/src/utils/youtubeApi.ts @@ -12,7 +12,7 @@ _youTubeAPI.authenticate({ export class YouTubeAPI { static listVideos(videoID: string, callback: (err: string | boolean, data: any) => void) { const part = 'contentDetails,snippet'; - if (videoID.length !== 11 || videoID.includes(".")) { + if (!videoID || videoID.length !== 11 || videoID.includes(".")) { callback("Invalid video ID", undefined); return; } @@ -24,7 +24,7 @@ export class YouTubeAPI { _youTubeAPI.videos.list({ part, id: videoID, - }, (ytErr: boolean | string, data: any) => { + }, (ytErr: boolean | string, { data }: any) => { if (!ytErr) { // Only set cache if data returned if (data.items.length > 0) {