chore: additional tags
This commit is contained in:
parent
d2a1f766ef
commit
0168d8acc4
4 changed files with 23 additions and 18 deletions
|
@ -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']),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ Software and services that I use for work and my own enjoyment.
|
|||
- [Trakt](https://trakt.tv)
|
||||
- [Letterboxd](https://letterboxd.com)
|
||||
- [Goodreads](https://goodreads.com)
|
||||
- [Matter](https://getmatter.com)
|
||||
- [Reader](https://readwise.io/read)
|
||||
- [Slack](http://slack.com)
|
||||
- [Discord](http://discord.com)
|
||||
|
||||
|
|
Reference in a new issue