offload now calls + generation to 11ty; add activity feed; cleanup
This commit is contained in:
parent
4bd059bc90
commit
4dd6cc9313
18 changed files with 192 additions and 93 deletions
13
src/_data/tv.js
Normal file
13
src/_data/tv.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
const { extract } = require('@extractus/feed-extractor')
|
||||
const { AssetCache } = require('@11ty/eleventy-fetch')
|
||||
|
||||
module.exports = async function () {
|
||||
const TV_KEY = process.env.API_KEY_TRAKT
|
||||
const url = `https://trakt.tv/users/cdransf/history.atom?slurm=${TV_KEY}`
|
||||
const asset = new AssetCache('tv_data')
|
||||
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
|
||||
const res = await extract(url).catch((error) => {})
|
||||
const data = res.entries.splice(0, 5)
|
||||
await asset.save(data, 'json')
|
||||
return data
|
||||
}
|
Reference in a new issue