feat: add movie posters to now page
This commit is contained in:
parent
4158faac60
commit
54e5e67643
6 changed files with 31 additions and 15 deletions
|
@ -5,10 +5,17 @@ module.exports = async function () {
|
|||
const url = 'https://letterboxd.com/cdme/rss'
|
||||
const asset = new AssetCache('movies_data')
|
||||
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
|
||||
const res = await extract(url).catch((error) => {
|
||||
const res = await extract(url, {
|
||||
getExtraEntryFields: (feedEntry) => {
|
||||
const images = feedEntry['description']?.match(/<img [^>]*src="[^"]*"[^>]*>/gm) || []
|
||||
return {
|
||||
image: images.length ? images.map((x) => x.replace(/.*src="([^"]*)".*/, '$1'))[0] : '',
|
||||
}
|
||||
},
|
||||
}).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