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
This commit is contained in:
parent
2c71dedb06
commit
460934752c
|
@ -200,9 +200,16 @@ export default Vue.extend({
|
||||||
result.player_response.videoDetails.viewCount,
|
result.player_response.videoDetails.viewCount,
|
||||||
10
|
10
|
||||||
)
|
)
|
||||||
this.channelId = result.videoDetails.author.id
|
if ('id' in result.videoDetails.author) {
|
||||||
this.channelName = result.videoDetails.author.name
|
this.channelId = result.videoDetails.author.id
|
||||||
this.channelThumbnail = result.videoDetails.author.thumbnails[0].url
|
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.videoPublished = new Date(result.videoDetails.publishDate.replace('-', '/')).getTime()
|
||||||
this.videoDescription = result.player_response.videoDetails.shortDescription
|
this.videoDescription = result.player_response.videoDetails.shortDescription
|
||||||
|
|
||||||
|
@ -337,9 +344,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
return object
|
return object
|
||||||
})
|
})
|
||||||
|
let captionLinks = result.player_response.captions
|
||||||
let captionLinks = result.playerResponse.captions
|
|
||||||
|
|
||||||
if (typeof captionLinks !== 'undefined') {
|
if (typeof captionLinks !== 'undefined') {
|
||||||
captionLinks = captionLinks.playerCaptionsTracklistRenderer.captionTracks.map((caption) => {
|
captionLinks = captionLinks.playerCaptionsTracklistRenderer.captionTracks.map((caption) => {
|
||||||
const label = `${caption.name.simpleText} (${caption.languageCode}) - text/vtt`
|
const label = `${caption.name.simpleText} (${caption.languageCode}) - text/vtt`
|
||||||
|
|
Loading…
Reference in New Issue