diff --git a/src/_data/books.js b/src/_data/books.js index c8b8702e..0fc5ca55 100644 --- a/src/_data/books.js +++ b/src/_data/books.js @@ -1,30 +1,12 @@ -const EleventyFetch = require('@11ty/eleventy-fetch') +const reading = require('./json/read.json') module.exports = async function () { - const OKU_URL = 'https://oku.club/api/collections/user/cory/reading' - const OPEN_LIBRARY_URL = 'https://openlibrary.org/search.json?title=' - const res = EleventyFetch(OKU_URL, { - duration: '1h', - type: 'json', - }).catch() - const data = await res - const books = [] - for (const book of data['books']) { - const res = await fetch(`${OPEN_LIBRARY_URL}${book.title.replace(/\s+/g, '+')}`) - .then((res) => res.json()) - .catch() - const data = await res - const coverId = data['docs'].find((b) => { - return b['title'] === book['title'] - })?.['cover_i'] - books.push({ - title: book.title, - author: book['authors'][0].name, - url: `https://oku.club/book/${book.slug}`, - cover: coverId - ? `https://books.coryd.dev/b/id/${coverId}-L.jpg` - : `https://cdn.coryd.dev/books/${book.title.toLowerCase().replace(/\s+/g, '-')}.jpg`, - }) - } - return books + return reading.map(read => { + if (read.status === 'started') return { + title: read.title, + author: read.authors.length > 1 ? read.authors.join(', ') : read.authors.pop(), + cover: read.thumbnail.replace('https://books.google.com', 'https://books.coryd.dev'), + link: `https://duckduckgo.com/?q=!olib%20${read.isbn}`, + } + }) } diff --git a/src/_includes/footer.liquid b/src/_includes/footer.liquid index 40864109..b25adb8e 100644 --- a/src/_includes/footer.liquid +++ b/src/_includes/footer.liquid @@ -7,7 +7,6 @@ {% include "icons/instapaper.liquid" %} {% include "icons/letterboxd.liquid" %} {% include "icons/trakt.liquid" %} - {% include "icons/oku.liquid" %} {% include "icons/coffee.liquid" %}
diff --git a/src/_includes/icons/oku.liquid b/src/_includes/icons/oku.liquid deleted file mode 100644 index 9c6b62e5..00000000 --- a/src/_includes/icons/oku.liquid +++ /dev/null @@ -1,13 +0,0 @@ -{% if site.oku != "" %} - - - -{% endif %} \ No newline at end of file diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index 5a3f18e2..05afbda9 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -117,15 +117,11 @@ layout: main {% heroicon "outline" "book-open" "Books" "height=28" %}