chore: instapaper -> pocket
This commit is contained in:
parent
c9c1ebf958
commit
3d70af1b2d
9 changed files with 34 additions and 39 deletions
4
.env
4
.env
|
@ -3,5 +3,7 @@ API_KEY_TRAKT=
|
|||
API_KEY_WEBMENTIONS_CORYD_DEV=
|
||||
API_BEARER_APPLE_MUSIC=
|
||||
API_TOKEN_APPLE_MUSIC=
|
||||
SECRET_FEED_INSTAPAPER_FAVORITES=
|
||||
APPLE_RENEW_TOKEN_URL=
|
||||
CONSUMER_KEY_POCKET=
|
||||
ACCESS_TOKEN_POCKET=
|
||||
SECRET_FEED_ALBUM_RELEASES=
|
|
@ -1,24 +1,31 @@
|
|||
const { extract } = require('@extractus/feed-extractor')
|
||||
const { AssetCache } = require('@11ty/eleventy-fetch')
|
||||
const EleventyFetch = require('@11ty/eleventy-fetch')
|
||||
|
||||
module.exports = async function () {
|
||||
const URL = process.env.SECRET_FEED_INSTAPAPER_LIKES
|
||||
// noinspection JSCheckFunctionSignatures
|
||||
const asset = new AssetCache('links_data')
|
||||
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
|
||||
const res = await extract(URL, {
|
||||
getExtraEntryFields: (feedEntry) => {
|
||||
return {
|
||||
time: feedEntry['pubDate'] || '',
|
||||
}
|
||||
const KEY = process.env.CONSUMER_KEY_POCKET
|
||||
const TOKEN = process.env.ACCESS_TOKEN_POCKET
|
||||
const url = 'https://getpocket.com/v3/get'
|
||||
const res = EleventyFetch(url, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
'consumer_key': KEY,
|
||||
'access_token': TOKEN,
|
||||
'favorite': 1,
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error.message)
|
||||
})
|
||||
.catch()
|
||||
const data = res.entries
|
||||
const links = data.splice(0, 5)
|
||||
await asset.save(links, 'json')
|
||||
return links
|
||||
},
|
||||
}).catch()
|
||||
const data = await res
|
||||
const articles = Object.values(data.list).map(article => {
|
||||
return {
|
||||
title: article['resolved_title'],
|
||||
url: article['resolved_url'],
|
||||
time: article['time_added']
|
||||
}
|
||||
})
|
||||
return articles.sort((a, b) => b.time - a.time).splice(0, 5)
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
{% if site.instapaper != "" %}
|
||||
<a
|
||||
href={{ site.instapaper }}
|
||||
rel="me"
|
||||
title="Instapaper">
|
||||
<svg
|
||||
class="inline w-6 h-6 fill-current text-gray-700 hover:text-purple-500 dark:text-gray-200 dark:hover:text-purple-500"
|
||||
role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M14.766 20.259c0 1.819.271 2.089 2.934 2.292V24H6.301v-1.449c2.666-.203 2.934-.473 2.934-2.292V3.708c0-1.784-.27-2.089-2.934-2.292V0h11.398v1.416c-2.662.203-2.934.506-2.934 2.292v16.551z"/>
|
||||
<title>Instapaper</title></svg>
|
||||
</a>
|
||||
{% endif %}
|
|
@ -138,7 +138,7 @@ layout: main
|
|||
<ul class="list-inside list-disc pl-5 md:pl-10">
|
||||
{% for link in links %}
|
||||
<li class="mt-1.5 mb-2">
|
||||
<a href="{{link.link}}" title="{{link.title | escape}}">
|
||||
<a href="{{link.url}}" title="{{link.title | escape}}">
|
||||
{{ link.title }}
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
{% include "icons/github.liquid" %}
|
||||
{% include "icons/mastodon.liquid" %}
|
||||
{% include "icons/apple-music.liquid" %}
|
||||
{% include "icons/instapaper.liquid" %}
|
||||
{% include "icons/letterboxd.liquid" %}
|
||||
{% include "icons/trakt.liquid" %}
|
||||
{% include "icons/coffee.liquid" %}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
Feed preview • links
|
||||
</h2>
|
||||
<p>Recently read and favorited links
|
||||
<a href="https://instapaper.com">sourced from my Instapaper likes.</a>
|
||||
<a href="https://getpocket.com">sourced from my Pocket favorites.</a>
|
||||
</p>
|
||||
<p>
|
||||
<xsl:value-of select="atom:feed/atom:description"/>
|
||||
|
|
|
@ -11,7 +11,7 @@ permalink: '/links.json'
|
|||
{
|
||||
"id": "{{ link.link }}",
|
||||
"title": "{{ link.title | escape }}",
|
||||
"url": "{{ link.link }}",
|
||||
"url": "{{ link.url }}",
|
||||
"content_text": "",
|
||||
"date_published": "{{ link.time | date: "%Y-%m-%dT%H:%M:%S-08:00" }}"
|
||||
}{% if not forloop.last %},{% endif %}
|
||||
|
|
|
@ -12,7 +12,7 @@ permalink: /links.xml
|
|||
<title>{{ link.title | escape }}</title>
|
||||
<link href="{{link.link}}" />
|
||||
<updated>{{ link.time | date: "%m.%d.%Y" }}</updated>
|
||||
<id>{{ link.link }}</id>
|
||||
<id>{{ link.url }}</id>
|
||||
<content type="html"></content>
|
||||
</entry>
|
||||
{% endfor %}
|
||||
|
|
|
@ -78,7 +78,7 @@ Software and services that I use for work and my own enjoyment.
|
|||
- [forwardemail.net](https://forwardemail.net)
|
||||
- [1Password](https://1password.com)
|
||||
- [Feedbin](https://feedbin.com)
|
||||
- [Instapaper](https://instapaper.com)
|
||||
- [Pocket](https://getpocket.com)
|
||||
- [Trakt](https://trakt.tv)
|
||||
- [Letterboxd](https://letterboxd.com)
|
||||
- [Whereby](https://whereby.com)
|
||||
|
|
Reference in a new issue