feat: dry up + normalize now page

This commit is contained in:
Cory Dransfeldt 2023-08-14 11:36:07 -07:00
parent 022ce82f81
commit 6dda493d7b
No known key found for this signature in database
13 changed files with 86 additions and 136 deletions

View file

@ -14,6 +14,19 @@ module.exports = async function () {
},
},
}).catch()
const shows = await res
return shows.splice(0, 6)
const data = await res
return data.map((episode) => {
return {
name: episode['show']['title'],
title: episode['episode']['title'],
url: `https://trakt.tv/shows/${episode['show']['ids']['slug']}/seasons/${episode['episode']['season']}/episodes/${episode['episode']['number']}`,
episode: `S${episode['episode']['season']}E${episode['episode']['number']}`,
image:
`https://cdn.coryd.dev/tv/${episode['show']['title']
.replace(':', '')
.replace(/\s+/g, '-')
.toLowerCase()}.jpg` || 'https://cdn.coryd.dev/tv/missing-tv.jpg',
type: 'tv',
}
})
}