chore: perf improvements
This commit is contained in:
parent
bb9a086c32
commit
de5cb2db8b
4 changed files with 21 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue