chore: perf improvements

This commit is contained in:
Cory Dransfeldt 2023-05-26 17:09:02 -07:00
parent bb9a086c32
commit de5cb2db8b
No known key found for this signature in database
4 changed files with 21 additions and 6 deletions

View file

@ -7,10 +7,17 @@ module.exports = async function () {
// noinspection JSCheckFunctionSignatures
const asset = new AssetCache('tv_data')
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
const res = await extract(url).catch((error) => {
const res = await extract(url, {
getExtraEntryFields: (feedEntry) => {
const image = feedEntry['media:thumbnail']['@_url']
return {
image,
}
},
}).catch((error) => {
console.log(error.message)
})
const data = res.entries.splice(0, 5)
const data = res.entries.splice(0, 6)
await asset.save(data, 'json')
return data
}