From 33d12238e913876b68763714dfe1e93660b7254a Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 12 May 2023 15:07:40 -0700 Subject: [PATCH] chore: use readwise for links --- src/_data/articles.js | 9 +++++---- src/_includes/feed-links.liquid | 2 +- src/_includes/now.liquid | 4 ++-- src/assets/atom-feed-links.xsl | 2 +- src/feeds/links.liquid | 12 ++++++------ src/uses.md | 9 ++++----- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/_data/articles.js b/src/_data/articles.js index e635942a..266d62cd 100644 --- a/src/_data/articles.js +++ b/src/_data/articles.js @@ -1,14 +1,15 @@ const EleventyFetch = require('@11ty/eleventy-fetch') module.exports = async function () { - const MATTER_TOKEN = process.env.ACCESS_TOKEN_MATTER - const headers = { Authorization: `Bearer ${MATTER_TOKEN}` } - const url = `https://web.getmatter.com/api/library_items/favorites_feed` + const READWISE_KEY = process.env.API_KEY_READWISE + const headers = { Authorization: `Token ${READWISE_KEY}` } + const url = `https://readwise.io/api/v3/list/?category=article` const res = EleventyFetch(url, { duration: '1h', type: 'json', fetchOptions: { headers }, }).catch() const feed = await res - return feed.feed.splice(0, 5) + const filtered = feed.results.filter((item) => Object.keys(item.tags).includes('shortlist')) + return filtered.splice(0, 5) } diff --git a/src/_includes/feed-links.liquid b/src/_includes/feed-links.liquid index a8993c29..a3375b38 100644 --- a/src/_includes/feed-links.liquid +++ b/src/_includes/feed-links.liquid @@ -7,7 +7,7 @@ - {% block update %}{{ articles[0].content.library.last_favorited_date | date: "%Y-%m-%dT%H:%M:%S-08:00" }}{% endblock %} + {% block update %}{{ articles[0].created_at | date: "%Y-%m-%dT%H:%M:%S-08:00" }}{% endblock %} {{ site.url }} {{ site.name }} diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index c5d37563..1f5c2e9a 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -119,8 +119,8 @@ layout: main