Actually search for a video with the exact same title

This commit is contained in:
Ealhad 2018-08-28 23:26:59 +02:00
parent 67beeca09d
commit ef98bb2885
1 changed files with 5 additions and 4 deletions

View File

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