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.')); + }); });