chore: drop links
This commit is contained in:
parent
457619ea2c
commit
d68db1993c
10 changed files with 2 additions and 70 deletions
|
@ -1,27 +0,0 @@
|
|||
const EleventyFetch = require('@11ty/eleventy-fetch')
|
||||
|
||||
module.exports = async function () {
|
||||
const READWISE_TOKEN = process.env.API_TOKEN_READWISE
|
||||
const headers = { Authorization: `Token ${READWISE_TOKEN}` }
|
||||
const url = 'https://readwise.io/api/v3/list?category=article'
|
||||
const res = EleventyFetch(url, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: { headers },
|
||||
})
|
||||
const data = await res
|
||||
const links = data['results'].filter((result) => Object.keys(result.tags).includes('share'))
|
||||
return links.map((link) => {
|
||||
return {
|
||||
title: link['title'],
|
||||
url: link['source_url'],
|
||||
date: link['published_date']
|
||||
? new Date(link['published_date'])
|
||||
: new Date(link['created_at']),
|
||||
summary: link['summary'],
|
||||
notes: link['notes'],
|
||||
tags: Object.keys(link.tags).filter((tag) => tag !== 'share' && tag !== 'shortlist'),
|
||||
id: btoa(link['source_url']),
|
||||
}
|
||||
})
|
||||
}
|
Reference in a new issue