chore: misc updates

This commit is contained in:
Cory Dransfeldt 2023-11-22 19:19:04 -08:00
parent 1746f8803a
commit 86b4a96a9e
16 changed files with 32 additions and 37 deletions

View file

@ -1,20 +1,26 @@
const EleventyFetch = require('@11ty/eleventy-fetch')
module.exports = async function () {
const API_TOKEN_PINBOARD = process.env.API_TOKEN_PINBOARD
const url = `https://api.pinboard.in/v1/posts/recent?auth_token=${API_TOKEN_PINBOARD}&format=json&tag=share`
const API_TOKEN_READWISE = process.env.API_TOKEN_READWISE
const url = 'https://readwise.io/api/v3/list?location=archive'
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
Authorization: `Token ${API_TOKEN_READWISE}`,
},
},
}).catch()
const links = await res
return links['posts'].map((link) => {
const data = await res
const links = data['results'].map((link) => {
return {
title: link['description'],
url: link['href'],
tags: [...new Set(link['tags'].split(' '))],
date: link['time'],
description: `${link['extended']}<br/><br/>`,
title: link['title'],
url: link['source_url'],
tags: [...new Set(Object.keys(link['tags']))],
date: link['created_at'],
description: `${link['summary']}<br/><br/>`,
}
})
return links.filter((link) => link.tags.includes('share'))
}