From 519128a99a5b7a44dc918ccf499f556fe0ee0f8c Mon Sep 17 00:00:00 2001 From: Preston Date: Sun, 11 Apr 2021 18:49:56 -0400 Subject: [PATCH] Fix issue with live videos causing errors in search results --- src/renderer/views/Search/Search.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/renderer/views/Search/Search.js b/src/renderer/views/Search/Search.js index 16855e45..b43e69df 100644 --- a/src/renderer/views/Search/Search.js +++ b/src/renderer/views/Search/Search.js @@ -136,17 +136,18 @@ export default Vue.extend({ return null }) - const returnDataInvidious = [] + const dataToShow = [] returnData.forEach((video) => { if (video.type === 'video') { + console.log(video) const authId = video.author.channelID const publishDate = video.uploadedAt let videoDuration = video.duration const videoId = video.id - if (video.duration !== null && video.duration !== '') { + if (videoDuration !== null && videoDuration !== '' && videoDuration !== 'LIVE') { videoDuration = ytTrendScraper.calculate_length_in_seconds(video.duration) } - returnDataInvidious.push( + dataToShow.push( { videoId: videoId, title: video.title, @@ -160,22 +161,22 @@ export default Vue.extend({ published: publishDate, publishedText: publishDate, lengthSeconds: videoDuration, - liveNow: video.isLive, + liveNow: video.isLive || videoDuration === 'LIVE', paid: false, premium: false, isUpcoming: false, - timeText: video.duration + timeText: videoDuration } ) } else { - returnDataInvidious.push(video) + dataToShow.push(video) } }) if (payload.nextPage) { - this.shownResults = this.shownResults.concat(returnDataInvidious) + this.shownResults = this.shownResults.concat(dataToShow) } else { - this.shownResults = returnDataInvidious + this.shownResults = dataToShow } this.nextPageRef = result.continuation