From ae6255cc69354cf5e829f911a8d025a78ce5f060 Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 20 Jan 2022 15:36:38 -0500 Subject: [PATCH] Add timeout to newleaf --- src/utils/youtubeApi.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/youtubeApi.ts b/src/utils/youtubeApi.ts index 1c962a1..ed6d674 100644 --- a/src/utils/youtubeApi.ts +++ b/src/utils/youtubeApi.ts @@ -27,7 +27,9 @@ export class YouTubeAPI { if (!config.newLeafURLs || config.newLeafURLs.length <= 0) return { err: "NewLeaf URL not found", data: null }; try { - const result = await axios.get(`${config.newLeafURLs[Math.floor(Math.random() * config.newLeafURLs.length)]}/api/v1/videos/${videoID}`); + const result = await axios.get(`${config.newLeafURLs[Math.floor(Math.random() * config.newLeafURLs.length)]}/api/v1/videos/${videoID}`, { + timeout: 3500 + }); if (result.status === 200) { const data = result.data;