From 6ca6e22fea6f4da08b42fd81193a55df08e4a02a Mon Sep 17 00:00:00 2001 From: LuanRT Date: Fri, 22 Oct 2021 04:38:33 -0300 Subject: [PATCH] chore: update examples --- examples/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/index.js b/examples/index.js index bf82de5d..685733d3 100644 --- a/examples/index.js +++ b/examples/index.js @@ -9,7 +9,10 @@ async function start() { // Searching, getting details about videos & making interactions: const search = await youtube.search('Looking for life on Mars - documentary'); console.info('Search results:', search); - + + if (search.videos.length === 0) + return console.info('[INFO]', 'Could not find any video about that on YouTube.'); + const video = await youtube.getDetails(search.videos[0].id); console.info('Video details:', video); if (video.error) return;