This repository has been archived on 2025-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
coryd.dev-eleventy/src/_data/tv.js
2023-05-26 20:25:18 -07:00

19 lines
504 B
JavaScript

const EleventyFetch = require('@11ty/eleventy-fetch')
module.exports = async function () {
const TV_KEY = process.env.API_KEY_TRAKT
const url = 'https://api.trakt.tv/users/cdransf/history/shows'
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
'Content-Type': 'application/json',
'trakt-api-version': 2,
'trakt-api-key': TV_KEY,
},
},
}).catch()
const shows = await res
return shows.splice(0, 6)
}