fix: small bug regarding how thumbnailOverlay was mapped

This commit is contained in:
Alex 2022-03-20 02:47:08 +13:00
parent f09f104254
commit 039e90fb90
2 changed files with 13 additions and 7 deletions

View File

@ -18,11 +18,7 @@
/>
</div>
<div v-text="video.title" style="margin-top: 0.5em" />
<div
v-text="
`${video.channel}${video.metadata.view}${video.metadata.published}`
"
/>
<div v-text="parseBottom(video)" />
</v-card-text>
</v-card>
</v-list-item>
@ -49,5 +45,13 @@ export default {
})
.catch((error) => this.$logger("Home Page", error, true));
},
methods: {
parseBottom(video) {
const bottomText = [video.channel, video.metadata.views];
if (video.metadata.published) bottomText.push(video.metadata.published);
return bottomText.join(" • ");
},
},
};
</script>

View File

@ -182,13 +182,15 @@ const recommendationModule = {
id: item.videoId,
title: item.title?.runs[0].text,
thumbnail: this.getThumbnail(item.videoId),
channel: item.shortBylineText.runs[0] ? item.shortBylineText.runs[0] : item.longBylineText.runs[0],
channel: item.shortBylineText?.runs[0] ? item.shortBylineText.runs[0].text : item.longBylineText?.runs[0].text,
channelURL: `${constants.YT_URL}/${(item.shortBylineText?.runs[0] ? item.shortBylineText.runs[0] : item.longBylineText?.runs[0]).navigationEndpoint?.browseEndpoint?.canonicalBaseUrl}`,
channelThumbnail: item.channelThumbnail?.thumbnails[0],
metadata: {
published: item.publishedTimeText?.runs[0].text,
views: item.shortViewCountText?.runs[0].text,
length: item.publishedTimeText?.runs[0].text,
overlay: item.thumbnailOverlays?.map((overlay) =>{overlay.thumbnailOverlayTimeStatusRenderer?.text.runs[0].runs}),
overlayStyle: item.thumbnailOverlays?.map(overlay => overlay.thumbnailOverlayTimeStatusRenderer?.style),
overlay: item.thumbnailOverlays?.map(overlay => overlay.thumbnailOverlayTimeStatusRenderer?.text.runs[0].text),
},
};
else return undefined