feat: goodreads -> storygraph
This commit is contained in:
parent
ac504b2837
commit
bbb9f59e76
10 changed files with 470 additions and 81 deletions
|
@ -1,34 +1,45 @@
|
|||
const Parser = require('rss-parser')
|
||||
const jsdom = require('jsdom')
|
||||
const { AssetCache } = require('@11ty/eleventy-fetch')
|
||||
const { JSDOM } = jsdom
|
||||
|
||||
module.exports = async function () {
|
||||
const parser = new Parser({
|
||||
customFields: {
|
||||
item: ['book_large_image_url', 'isbn', 'book_description', 'user_date_added'],
|
||||
},
|
||||
})
|
||||
const url = process.env.SECRET_FEED_GOODREADS
|
||||
const url = 'https://app.thestorygraph.com/currently-reading/coryd'
|
||||
const asset = new AssetCache('books_data')
|
||||
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
|
||||
const data = []
|
||||
const res = await parser.parseURL(url).catch((error) => {
|
||||
console.log(error.message)
|
||||
})
|
||||
res.items.forEach((book) => {
|
||||
data.push({
|
||||
image: book['book_large_image_url'].replace(
|
||||
'https://i.gr-assets.com',
|
||||
'https://books.coryd.dev'
|
||||
),
|
||||
title: book['title'],
|
||||
url: book['link'],
|
||||
isbn: book['isbn'],
|
||||
description: `${book['book_description']}<br/><br/>`,
|
||||
dateAdded: book['user_date_added'],
|
||||
type: 'book',
|
||||
await fetch(url)
|
||||
.then((res) => res.text())
|
||||
.then((html) => {
|
||||
const DOM = new JSDOM(html)
|
||||
const doc = DOM.window.document
|
||||
doc
|
||||
.querySelectorAll('.md\\:block .book-title-author-and-series h3 > a')
|
||||
.forEach((title, index) => {
|
||||
if (!data[index]) data.push({ title: title.textContent })
|
||||
if (data[index]) data[index]['title'] = title.textContent
|
||||
})
|
||||
doc
|
||||
.querySelectorAll('.md\\:block .book-title-author-and-series h3 p:last-of-type > a')
|
||||
.forEach((author, index) => {
|
||||
if (!data[index]) data.push({ author: author.textContent })
|
||||
if (data[index]) data[index]['author'] = author.textContent
|
||||
})
|
||||
doc.querySelectorAll('.md\\:block .book-cover img').forEach((image, index) => {
|
||||
if (!data[index]) data.push({ image: image.src })
|
||||
if (data[index]) data[index]['image'] = image.src
|
||||
})
|
||||
doc.querySelectorAll('.md\\:block .book-cover a').forEach((url, index) => {
|
||||
if (!data[index]) data.push({ url: `https://app.thestorygraph.com${url.href}` })
|
||||
if (data[index]) data[index]['url'] = `https://app.thestorygraph.com${url.href}`
|
||||
})
|
||||
})
|
||||
const books = data
|
||||
.filter((book) => book.title)
|
||||
.map((book) => {
|
||||
book.type = 'book'
|
||||
book.dateAdded = new Date()
|
||||
return book
|
||||
})
|
||||
})
|
||||
const books = data.splice(0, 6)
|
||||
await asset.save(books, 'json')
|
||||
return books
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = async function () {
|
|||
icon: 'device-airpods',
|
||||
},
|
||||
{ name: 'Trakt', url: 'https://trakt.tv/users/cdransf', icon: 'device-tv' },
|
||||
{ name: 'Goodreads', url: 'https://www.goodreads.com/cdransf', icon: 'books' },
|
||||
{ name: 'StoryGraph', url: 'https://app.thestorygraph.com/profile/coryd', icon: 'books' },
|
||||
{ name: 'Buy Me a Coffee', url: 'https://www.buymeacoffee.com/cory', icon: 'cup' },
|
||||
],
|
||||
resume: [
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="dark:text-white text-gray-800">
|
||||
<p>I'm a software developer in Camarillo, California. I enjoy hanging out with my beautiful family and 4 rescue dogs, technology, automation,
|
||||
<a href="https://music.apple.com/profile/cdransf" rel="noopener noreferrer">music</a>, writing,
|
||||
<a href="https://www.goodreads.com/user/show/168570560-cory-dransfeldt" rel="noopener noreferrer">reading</a>,
|
||||
<a href="https://app.thestorygraph.com/profile/coryd" rel="noopener noreferrer">reading</a>,
|
||||
<a href="https://trakt.tv/users/cdransf" rel="noopener noreferrer">tv</a>
|
||||
and
|
||||
<a href="https://trakt.tv/users/cdransf" rel="noopener noreferrer">movies</a>.</p>
|
||||
|
|
|
@ -17,6 +17,7 @@ meta:
|
|||
image:
|
||||
src: https://coryd.dev/assets/img/avatar.webp
|
||||
---
|
||||
|
||||
<div class="flex items-center justify-center w-full not-prose mb-6">
|
||||
<div class="border border-teal-700 dark:border-teal-300 bg-white rounded-full overflow-hidden p-4">
|
||||
{% capture about_alt %}{{ site.name }} - image by David Neal / @reverentgeek{% endcapture %}
|
||||
|
@ -25,7 +26,7 @@ meta:
|
|||
</div>
|
||||
<h1 class="text-xxl font-black -leading-tight tracking-normal dark:text-gray-200 md:text-3xl text-center">Hi, I'm Cory</h1>
|
||||
|
||||
I'm a software developer in Camarillo, California. I enjoy hanging out with my beautiful family and 4 rescue dogs, technology, automation, [music](https://music.apple.com/profile/cdransf), writing, [reading](https://www.goodreads.com/user/show/168570560-cory-dransfeldt), [tv](https://trakt.tv/users/cdransf) and [movies](https://trakt.tv/users/cdransf).
|
||||
I'm a software developer in Camarillo, California. I enjoy hanging out with my beautiful family and 4 rescue dogs, technology, automation, [music](https://music.apple.com/profile/cdransf), writing, [reading](https://app.thestorygraph.com/profile/coryd), [tv](https://trakt.tv/users/cdransf) and [movies](https://trakt.tv/users/cdransf).
|
||||
|
||||
I build, maintain and design web applications. I've been coding professionally since 2010 with a focus on frontend technologies. I help organize [the Eleventy Meetup](https://11tymeetup.dev) and mentor for [Underdog Devs](https://www.underdogdevs.org).
|
||||
|
||||
|
|
14
src/uses.md
14
src/uses.md
|
@ -60,13 +60,13 @@ Software and services that I use for work and my own enjoyment.
|
|||
- [AirBuddy](https://v2.airbuddy.app): finer-grained control over AirPods and other wireless devices.
|
||||
- [Meta](https://www.nightbirdsevolve.com/meta): the _best_ utility for tagging and organizing music files on macOS.
|
||||
- [Permute](https://software.charliemonroe.net/permute): a useful utility for quickly converting files to different formats.
|
||||
- [SoundSource](https://rogueamoeba.com/soundsource)
|
||||
- [Sleeve](https://replay.software/sleeve)
|
||||
- [SoundSource](https://rogueamoeba.com/soundsource): a handy utility for better, more granular control on macOS.
|
||||
- [Sleeve](https://replay.software/sleeve): my favorite Music.app controller (it works with Spotify too). I'll always have a softspot for Bowtie and Ecoute though.
|
||||
|
||||
<h3 className="text-xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-2xl sm:leading-10 md:text-4xl md:leading-14">Dev tools</h3>
|
||||
|
||||
- [Nova](https://nova.app)
|
||||
- [iTerm2](https://iterm2.com)
|
||||
- [Nova](https://nova.app): Panic's code editor has come a long way. It's stable, fully-featured and native (VS Code is an institution at this point, but monocultures are, well, bad).
|
||||
- [iTerm2](https://iterm2.com): a more configurable terminal than the one macOS ships with. I've used it for a long time now and it's still my go-to.
|
||||
- [Catppuccin](https://github.com/catppuccin)
|
||||
- [Mono Lisa](https://monolisa.dev)
|
||||
|
||||
|
@ -84,9 +84,9 @@ Software and services that I use for work and my own enjoyment.
|
|||
- [Feedbin](https://feedbin.com)
|
||||
- [forwardemail.net](https://forwardemail.net)
|
||||
- [Trakt](https://trakt.tv)
|
||||
- [Goodreads](https://goodreads.com)
|
||||
- [Slack](http://slack.com)
|
||||
- [Discord](http://discord.com)
|
||||
- [The Storygraph](https://thestorygraph.com): an excellent, focused and community driven book tracking app. All it needs is RSS/Atom feeds and/or an API.
|
||||
- [Slack](http://slack.com): I have a family Slack set up to avoid group text messages and am in a few other community Slacks.
|
||||
- [Discord](http://discord.com): I don't _like_ Discord but, for better or worse, it's where some communities I frequent are.
|
||||
- [Backblaze](https://www.backblaze.com/cloud-backup)
|
||||
|
||||
Check out [uses.tech](https://uses.tech) for more lists like this one.
|
||||
|
|
Reference in a new issue