chore: use readwise for links

This commit is contained in:
Cory Dransfeldt 2023-05-12 15:07:40 -07:00
parent 440e7694a9
commit 33d12238e9
No known key found for this signature in database
6 changed files with 19 additions and 19 deletions

View file

@ -1,14 +1,15 @@
const EleventyFetch = require('@11ty/eleventy-fetch')
module.exports = async function () {
const MATTER_TOKEN = process.env.ACCESS_TOKEN_MATTER
const headers = { Authorization: `Bearer ${MATTER_TOKEN}` }
const url = `https://web.getmatter.com/api/library_items/favorites_feed`
const READWISE_KEY = process.env.API_KEY_READWISE
const headers = { Authorization: `Token ${READWISE_KEY}` }
const url = `https://readwise.io/api/v3/list/?category=article`
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: { headers },
}).catch()
const feed = await res
return feed.feed.splice(0, 5)
const filtered = feed.results.filter((item) => Object.keys(item.tags).includes('shortlist'))
return filtered.splice(0, 5)
}