From 460934752c884822d7e768294f26756465fdd7cf Mon Sep 17 00:00:00 2001 From: Luca Hohmann <34301369+GilgusMaximus@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:35:03 +0100 Subject: [PATCH] Fail-Safe fix when author data of video is missing (#825) * Fail-Safe fix when author data of video is missing * Fixed linter issues by replacing hasownproperty with in * Implemented Prestons addition for the user thumbnail --- src/renderer/views/Watch/Watch.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 8d6316b7..e9ff2a8b 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -200,9 +200,16 @@ export default Vue.extend({ result.player_response.videoDetails.viewCount, 10 ) - this.channelId = result.videoDetails.author.id - this.channelName = result.videoDetails.author.name - this.channelThumbnail = result.videoDetails.author.thumbnails[0].url + if ('id' in result.videoDetails.author) { + this.channelId = result.videoDetails.author.id + this.channelName = result.videoDetails.author.name + console.log(result) + this.channelThumbnail = result.videoDetails.author.thumbnails[0].url + } else { + this.channelId = result.player_response.videoDetails.channelId + this.channelName = result.player_response.videoDetails.author + this.channelThumbnail = result.player_response.embedPreview.thumbnailPreviewRenderer.videoDetails.embeddedPlayerOverlayVideoDetailsRenderer.channelThumbnail.thumbnails[0].url + } this.videoPublished = new Date(result.videoDetails.publishDate.replace('-', '/')).getTime() this.videoDescription = result.player_response.videoDetails.shortDescription @@ -337,9 +344,7 @@ export default Vue.extend({ return object }) - - let captionLinks = result.playerResponse.captions - + let captionLinks = result.player_response.captions if (typeof captionLinks !== 'undefined') { captionLinks = captionLinks.playerCaptionsTracklistRenderer.captionTracks.map((caption) => { const label = `${caption.name.simpleText} (${caption.languageCode}) - text/vtt`