chore: update uses
This commit is contained in:
parent
aa5fd1bb0f
commit
98708877b8
6 changed files with 22 additions and 432 deletions
|
@ -1,26 +1,26 @@
|
|||
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 MATTER_TOKEN = process.env.ACCESS_TOKEN_MATTER
|
||||
const headers = { Cookie: MATTER_TOKEN }
|
||||
const url = `https://web.getmatter.com/api/library_items/favorites_feed`
|
||||
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) => {
|
||||
const feed = await res
|
||||
const articles = feed.feed
|
||||
return articles.reverse().map((article) => {
|
||||
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'],
|
||||
id: btoa(link['source_url']),
|
||||
url: article['content']['url'],
|
||||
title: article['content']['title'],
|
||||
date: article['content']['publication_date']
|
||||
? new Date(article['content']['publication_date'])
|
||||
: new Date(article['content']['feed_date']),
|
||||
summary: article['content']['excerpt'],
|
||||
notes: article['content']['my_notes'],
|
||||
id: btoa(article['id']),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Reference in a new issue