quick fix
This commit is contained in:
parent
e8274a1a65
commit
55eb1c76c5
@ -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) {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user