quick fix

This commit is contained in:
Evert Prants 2019-11-14 19:08:48 +02:00
parent e8274a1a65
commit 55eb1c76c5
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 3 additions and 4 deletions

View File

@ -48,8 +48,7 @@ function getVideoInfo (arg) {
return new Promise((resolve, reject) => {
yt.on('close', function () {
let ftdata = output.split('\n')
console.log(ftdata.length)
let ftdata = output.trim().split('\n')
if (ftdata.length > 1) {
let composite = []
for (let i in ftdata) {

View File

@ -67,7 +67,7 @@ async function getTrackMetaReal (id) {
candidates.push(obj)
}
if (candidates.length) {
if (candidates.length && !bestMatch) {
// Sort candidates by view count
candidates = candidates.sort(function (a, b) {
return b.view_count - a.view_count
@ -78,7 +78,7 @@ async function getTrackMetaReal (id) {
}
// If there were no suitable candidates, just take the first response
if (!candidates.length) bestMatch = dldata[0]
if (!candidates.length && !bestMatch) bestMatch = dldata[0]
externalTracks[id] = {
id: trdata.id,