chore: additional tags

This commit is contained in:
Cory Dransfeldt 2023-09-13 18:04:31 -07:00
parent d2a1f766ef
commit 0168d8acc4
No known key found for this signature in database
4 changed files with 23 additions and 18 deletions

View file

@ -1,27 +1,27 @@
const EleventyFetch = require('@11ty/eleventy-fetch')
module.exports = async function () {
const MATTER_TOKEN = process.env.ACCESS_TOKEN_MATTER
const headers = { Cookie: MATTER_TOKEN }
const url = `https://web.getmatter.com/api/library_items/favorites_feed`
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 feed = await res
return feed.feed.map((article) => {
const tags = article['content']['tags'].map((tag) => tag['name'])
const data = await res
const links = data['results'].filter((result) => Object.keys(result.tags).includes('share'))
return links.map((link) => {
return {
url: article['content']['url'],
title: article['content']['title'],
date: article['content']['library']['modified_date']
? new Date(article['content']['library']['modified_date'])
: new Date(article['content']['publication_date']),
description: article['content']['excerpt'],
notes: article['content']['my_notes'] || '',
tags,
id: btoa(article['id']),
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']),
}
})
}