From ef98bb2885c65c967909c417823d9526775f34b3 Mon Sep 17 00:00:00 2001 From: Ealhad Date: Tue, 28 Aug 2018 23:26:59 +0200 Subject: [PATCH] Actually search for a video with the exact same title --- src/background.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/background.ts b/src/background.ts index 213bf0b..50dbfc6 100644 --- a/src/background.ts +++ b/src/background.ts @@ -29,11 +29,12 @@ const search = query => new Promise(async (resolve, reject) => { .then(function(data) { if (data.total > 0) { const video = data.data[0] - resolve(video); - } else { - reject(new Error('No results.')) + if (video.name === query) { + resolve(video); + } } - }) + reject(new Error('No results.')); + }); });