channel channels

This commit is contained in:
Nikita Krupin 2022-05-18 19:36:27 -04:00
parent 329fa35707
commit c4bd494677
3 changed files with 35 additions and 4 deletions

View File

@ -36,8 +36,7 @@
<div
v-for="title in video.title.runs"
:key="title.text"
style="margin-top: 0.5em"
class="vid-title"
class="vid-title mt-1"
>
{{ title.text }}
</div>

View File

@ -1,3 +1,21 @@
<template>
<div></div>
<div class="pt-4">
<v-list-item
v-for="(channel, index) in $store.state.channel.featuredChannels"
:key="index"
class="pa-0 min-height-0"
>
<compact-channel-renderer
:video="channel.gridChannelRenderer"
></compact-channel-renderer>
</v-list-item>
</div>
</template>
<script>
import compactChannelRenderer from "../../components/CompactRenderers/compactChannelRenderer.vue";
export default {
components: { compactChannelRenderer },
};
</script>

View File

@ -10,6 +10,7 @@ const getDefaultState = () => {
descriptionPreview: null,
subscribers: null,
videosCount: null,
featuredChannels: null,
};
};
export const state = () => {
@ -25,7 +26,7 @@ export const actions = {
this.$youtube
.getChannel(channelRequest)
.then((channel) => {
console.log(channel);
// console.log(channel);
state.loading = false;
state.banner =
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelBanner?.image.sources[0].url;
@ -43,6 +44,19 @@ export const actions = {
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.metadata.subscriberCountText;
state.videosCount =
channel.header.channelMobileHeaderRenderer.channelHeader.elementRenderer.newElement.type.componentType.model.channelHeaderModel.channelProfile.metadata.videosCountText;
const featuredSection =
channel.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.find(
(i) => {
return !!i?.shelfRenderer?.content?.horizontalListRenderer
?.items[0].gridChannelRenderer;
}
);
console.log("CHANNEL INDEX");
console.log(featuredSection);
state.featuredChannels =
featuredSection.shelfRenderer.content.horizontalListRenderer.items;
console.log("ITEMS ITEMS");
console.log(state.featuredChannels);
})
.catch((err) => {
state.loading = false;