feat: eleventy transform for images

This commit is contained in:
Cory Dransfeldt 2024-02-13 15:28:28 -08:00
parent 243b1103e4
commit 7e1597b36a
No known key found for this signature in database
36 changed files with 179 additions and 1262 deletions

View file

@ -1,9 +1,7 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import AlbumsMock from './json/mocks/albums.js'
const ALBUM_DENYLIST = ['no-love-deep-web', 'unremittance', 'celebratory-beheading']
export default async function () {
const ALBUM_DENYLIST = ['no-love-deep-web', 'unremittance', 'celebratory-beheading']
const MUSIC_KEY = process.env.API_KEY_LASTFM
const url = `https://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=coryd_&api_key=${MUSIC_KEY}&limit=8&format=json&period=7day`
const formatAlbumData = (albums) => albums.map((album) => {
@ -27,14 +25,10 @@ export default async function () {
}
})
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch()
const data = await res
return formatAlbumData(data['topalbums']['album'])
} else {
return formatAlbumData(AlbumsMock);
}
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch()
const data = await res
return formatAlbumData(data['topalbums']['album'])
}

View file

@ -1,24 +1,18 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import AnalyticsMock from './json/mocks/analytics.js'
export default async function () {
const API_KEY_PLAUSIBLE = process.env.API_KEY_PLAUSIBLE
const url =
'https://plausible.io/api/v1/stats/breakdown?site_id=coryd.dev&period=6mo&property=event:page&limit=30'
let pages;
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
Authorization: `Bearer ${API_KEY_PLAUSIBLE}`,
},
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
Authorization: `Bearer ${API_KEY_PLAUSIBLE}`,
},
}).catch()
pages = await res
} else {
pages = AnalyticsMock
}
},
}).catch()
const pages = await res
return pages.results.filter((p) => p.page.includes('posts'))
}

View file

@ -1,6 +1,5 @@
import EleventyFetch from '@11ty/eleventy-fetch';
import mbidPatches from './json/mbid-patches.js';
import ArtistsMock from './json/mocks/artists.js'
const mbidMap = (artist) => {
return mbidPatches[artist.toLowerCase()] || '';
@ -37,14 +36,10 @@ export default async function () {
};
});
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch();
const data = await res;
return formatArtistData(data['topartists']['artist'])
} else {
return formatArtistData(ArtistsMock);
}
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch();
const data = await res;
return formatArtistData(data['topartists']['artist'])
}

View file

@ -1,75 +1,70 @@
import jsdom from 'jsdom'
import { AssetCache } from '@11ty/eleventy-fetch'
import BooksMock from './json/mocks/books.js'
const { JSDOM } = jsdom
export default async function () {
const COOKIE = process.env.COOKIE_STORYGRAPH
const url = 'https://app.thestorygraph.com/currently-reading/coryd'
if (process.env.ELEVENTY_PRODUCTION) {
const asset = new AssetCache('books_data')
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
const data = []
await fetch(url, {
headers: {
Cookie: COOKIE,
},
})
.then((res) => res.text())
.then((html) => {
const DOM = new JSDOM(html)
const doc = DOM.window.document
const bookCount = doc.querySelectorAll('.book-pane-content').length
const titles = doc.querySelectorAll('.book-title-author-and-series h3 > a')
const authors = doc.querySelectorAll('.book-title-author-and-series h3 p:last-of-type > a')
const images = doc.querySelectorAll('.md\\:block .book-cover img')
const urls = doc.querySelectorAll('.md\\:block .book-cover a')
const percentages = doc.querySelectorAll('.md\\:block .progress-tracker-pane .font-semibold')
const dates = doc.querySelectorAll('.md\\:block .action-menu a p')
const asset = new AssetCache('books_data')
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
const data = []
await fetch(url, {
headers: {
Cookie: COOKIE,
},
})
.then((res) => res.text())
.then((html) => {
const DOM = new JSDOM(html)
const doc = DOM.window.document
const bookCount = doc.querySelectorAll('.book-pane-content').length
const titles = doc.querySelectorAll('.book-title-author-and-series h3 > a')
const authors = doc.querySelectorAll('.book-title-author-and-series h3 p:last-of-type > a')
const images = doc.querySelectorAll('.md\\:block .book-cover img')
const urls = doc.querySelectorAll('.md\\:block .book-cover a')
const percentages = doc.querySelectorAll('.md\\:block .progress-tracker-pane .font-semibold')
const dates = doc.querySelectorAll('.md\\:block .action-menu a p')
for (let i = 0; i < bookCount; i++) {
const date = new Date(
dates[i]?.textContent.replace('Started ', '').split('\n')[0]
).toLocaleString('en-US', {
timeZone: 'America/Los_Angeles',
})
for (let i = 0; i < bookCount; i++) {
const date = new Date(
dates[i]?.textContent.replace('Started ', '').split('\n')[0]
).toLocaleString('en-US', {
timeZone: 'America/Los_Angeles',
})
if (!data[i]) {
data.push({ title: titles[i]?.textContent })
data.push({ author: authors[i]?.textContent })
data.push({
image: images[i].src.replace(
'https://cdn.thestorygraph.com',
'https://cd-books.b-cdn.net'
),
})
data.push({ url: `https://app.thestorygraph.com${urls[i].href}` })
data.push({ percentage: percentages[i]?.textContent })
data.push({
dateAdded: date,
})
data.push({ type: 'book' })
}
if (data[i]) {
data[i]['title'] = titles[i]?.textContent
data[i]['author'] = authors[i]?.textContent
data[i]['image'] = images[i]?.src.replace(
if (!data[i]) {
data.push({ title: titles[i]?.textContent })
data.push({ author: authors[i]?.textContent })
data.push({
image: images[i].src.replace(
'https://cdn.thestorygraph.com',
'https://cd-books.b-cdn.net'
)
data[i]['url'] = `https://app.thestorygraph.com${urls[i]?.href}`
data[i]['percentage'] = percentages[i]?.textContent
data[i]['dateAdded'] = date
data[i]['type'] = 'book'
}
),
})
data.push({ url: `https://app.thestorygraph.com${urls[i].href}` })
data.push({ percentage: percentages[i]?.textContent })
data.push({
dateAdded: date,
})
data.push({ type: 'book' })
}
})
const books = data.filter((book) => book.title)
await asset.save(books, 'json')
return books
} else {
return BooksMock
}
if (data[i]) {
data[i]['title'] = titles[i]?.textContent
data[i]['author'] = authors[i]?.textContent
data[i]['image'] = images[i]?.src.replace(
'https://cdn.thestorygraph.com',
'https://cd-books.b-cdn.net'
)
data[i]['url'] = `https://app.thestorygraph.com${urls[i]?.href}`
data[i]['percentage'] = percentages[i]?.textContent
data[i]['dateAdded'] = date
data[i]['type'] = 'book'
}
}
})
const books = data.filter((book) => book.title)
await asset.save(books, 'json')
return books
}

View file

@ -1,258 +0,0 @@
export default [
{
"artist": {
"url": "https://www.last.fm/music/Hauntologist",
"name": "Hauntologist",
"mbid": "3cb2b7a7-53e6-4b0c-9143-16227fc5d1c3"
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/5846746d971a039ac66e120f96a73d1b.jpg"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/5846746d971a039ac66e120f96a73d1b.jpg"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/5846746d971a039ac66e120f96a73d1b.jpg"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/5846746d971a039ac66e120f96a73d1b.jpg"
}
],
"mbid": "c7a88e0d-681c-46b7-be5a-8af7c660a57a",
"url": "https://www.last.fm/music/Hauntologist/Hollow",
"playcount": "32",
"@attr": {
"rank": "1"
},
"name": "Hollow"
},
{
"artist": {
"url": "https://www.last.fm/music/dissimulator",
"name": "dissimulator",
"mbid": "6c3b93e1-d3e7-413c-b030-b6ddd918676f"
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/4187cd6dcf48fdc84cfd9cbf2c9f7cca.jpg"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/4187cd6dcf48fdc84cfd9cbf2c9f7cca.jpg"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/4187cd6dcf48fdc84cfd9cbf2c9f7cca.jpg"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/4187cd6dcf48fdc84cfd9cbf2c9f7cca.jpg"
}
],
"mbid": "87de5dc1-e7ec-4011-a9a7-38b875398a58",
"url": "https://www.last.fm/music/dissimulator/Lower+Form+Resistance",
"playcount": "21",
"@attr": {
"rank": "2"
},
"name": "Lower Form Resistance"
},
{
"artist": {
"url": "https://www.last.fm/music/Aesop+Rock",
"name": "Aesop Rock",
"mbid": "aba64937-3334-4c65-90a1-4e6b9d4d7ada"
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/f48ad490ad9259825a1bf155be03f685.jpg"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/f48ad490ad9259825a1bf155be03f685.jpg"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/f48ad490ad9259825a1bf155be03f685.jpg"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/f48ad490ad9259825a1bf155be03f685.jpg"
}
],
"mbid": "8db6e790-7d34-453d-9ac0-f8b6a91b732d",
"url": "https://www.last.fm/music/Aesop+Rock/Integrated+Tech+Solutions",
"playcount": "18",
"@attr": {
"rank": "3"
},
"name": "Integrated Tech Solutions"
},
{
"artist": {
"url": "https://www.last.fm/music/Sepulcher",
"name": "Sepulcher",
"mbid": "48cb1769-b1fe-4730-a088-d83be4dc01ef"
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/3e7b1e98d0d303e60c6d0c8d596d0c33.jpg"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/3e7b1e98d0d303e60c6d0c8d596d0c33.jpg"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/3e7b1e98d0d303e60c6d0c8d596d0c33.jpg"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/3e7b1e98d0d303e60c6d0c8d596d0c33.jpg"
}
],
"mbid": "bc021289-1ec3-4057-864e-5709b11ed5e1",
"url": "https://www.last.fm/music/Sepulcher/Panoptic+Horror",
"playcount": "14",
"@attr": {
"rank": "4"
},
"name": "Panoptic Horror"
},
{
"artist": {
"url": "https://www.last.fm/music/AFI",
"name": "AFI",
"mbid": ""
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/aaab03cb19f0487383cb19957a5d92b7.png"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/aaab03cb19f0487383cb19957a5d92b7.png"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/aaab03cb19f0487383cb19957a5d92b7.png"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/aaab03cb19f0487383cb19957a5d92b7.png"
}
],
"mbid": "0f50ea53-37b4-31ef-aff2-e1d9b8763517",
"url": "https://www.last.fm/music/AFI/Crash+Love",
"playcount": "13",
"@attr": {
"rank": "5"
},
"name": "Crash Love"
},
{
"artist": {
"url": "https://www.last.fm/music/AFI",
"name": "AFI",
"mbid": ""
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/d0a4b04bf955443b83095ac7752afb4b.png"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/d0a4b04bf955443b83095ac7752afb4b.png"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/d0a4b04bf955443b83095ac7752afb4b.png"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/d0a4b04bf955443b83095ac7752afb4b.png"
}
],
"mbid": "1f315994-b360-46c8-9241-303c49ff4741",
"url": "https://www.last.fm/music/AFI/Decemberunderground",
"playcount": "13",
"@attr": {
"rank": "6"
},
"name": "Decemberunderground"
},
{
"artist": {
"url": "https://www.last.fm/music/Defeated+Sanity",
"name": "Defeated Sanity",
"mbid": "47a9a488-a721-4d0e-88bc-2452701fb9c9"
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/71fb8b597d7ae9c0987eb3a88a904c8e.jpg"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/71fb8b597d7ae9c0987eb3a88a904c8e.jpg"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/71fb8b597d7ae9c0987eb3a88a904c8e.jpg"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/71fb8b597d7ae9c0987eb3a88a904c8e.jpg"
}
],
"mbid": "2ce66939-5907-4953-b81d-67b0a736438c",
"url": "https://www.last.fm/music/Defeated+Sanity/Chapters+Of+Repugnance",
"playcount": "12",
"@attr": {
"rank": "7"
},
"name": "Chapters Of Repugnance"
},
{
"artist": {
"url": "https://www.last.fm/music/Unaussprechlichen+Kulten",
"name": "Unaussprechlichen Kulten",
"mbid": "dd4d9439-87ee-455d-a8b3-a96364845233"
},
"image": [
{
"size": "small",
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/725c65aaeb1dbae8033dfec452c6ec55.jpg"
},
{
"size": "medium",
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/725c65aaeb1dbae8033dfec452c6ec55.jpg"
},
{
"size": "large",
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/725c65aaeb1dbae8033dfec452c6ec55.jpg"
},
{
"size": "extralarge",
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/725c65aaeb1dbae8033dfec452c6ec55.jpg"
}
],
"mbid": "2e9bac0f-33bc-4721-b907-978c0e2c4bb1",
"url": "https://www.last.fm/music/Unaussprechlichen+Kulten/H%C3%A4xan+Sabaoth",
"playcount": "12",
"@attr": {
"rank": "8"
},
"name": "Häxan Sabaoth"
}
]

View file

@ -1,44 +0,0 @@
export default {
"results": [
{
"page": "/posts/2024/i-dont-want-anything-your-ai-generates/",
"visitors": 11057
},
{
"page": "/posts/2024/i-found-the-music-i-love-on-the-internet/",
"visitors": 4535
},
{
"page": "/posts/2023/i-removed-tailwind-from-my-site/",
"visitors": 843
},
{
"page": "/posts/2023/default-apps-2023/",
"visitors": 594
},
{
"page": "/posts/2023/check-in-to-your-personal-site/",
"visitors": 523
},
{
"page": "/posts/2024/your-site-your-home-your-web/",
"visitors": 356
},
{
"page": "/posts/2023/i-dont-want-streaming-music/",
"visitors": 350
},
{
"page": "/posts/2024/you-dont-need-a-framework-for-that/",
"visitors": 271
},
{
"page": "/posts/2023/i-block-ads/",
"visitors": 259
},
{
"page": "/posts/2023/leaning-into-google-services/",
"visitors": 249
}
]
}

View file

@ -1,74 +0,0 @@
export default [
{
"mbid": "",
"url": "https://www.last.fm/music/AFI",
"playcount": "37",
"@attr": {
"rank": "1"
},
"name": "AFI"
},
{
"mbid": "3cb2b7a7-53e6-4b0c-9143-16227fc5d1c3",
"url": "https://www.last.fm/music/Hauntologist",
"playcount": "32",
"@attr": {
"rank": "2"
},
"name": "Hauntologist"
},
{
"mbid": "47a9a488-a721-4d0e-88bc-2452701fb9c9",
"url": "https://www.last.fm/music/Defeated+Sanity",
"playcount": "30",
"@attr": {
"rank": "3"
},
"name": "Defeated Sanity"
},
{
"mbid": "37e9d7b2-7779-41b2-b2eb-3685351caad3",
"url": "https://www.last.fm/music/NoMeansNo",
"playcount": "27",
"@attr": {
"rank": "4"
},
"name": "NoMeansNo"
},
{
"mbid": "aba64937-3334-4c65-90a1-4e6b9d4d7ada",
"url": "https://www.last.fm/music/Aesop+Rock",
"playcount": "26",
"@attr": {
"rank": "5"
},
"name": "Aesop Rock"
},
{
"mbid": "7961aa2c-36d4-4601-a691-981b18143991",
"url": "https://www.last.fm/music/Galvanizer",
"playcount": "24",
"@attr": {
"rank": "6"
},
"name": "Galvanizer"
},
{
"mbid": "48cb1769-b1fe-4730-a088-d83be4dc01ef",
"url": "https://www.last.fm/music/Sepulcher",
"playcount": "24",
"@attr": {
"rank": "7"
},
"name": "Sepulcher"
},
{
"mbid": "6c3b93e1-d3e7-413c-b030-b6ddd918676f",
"url": "https://www.last.fm/music/dissimulator",
"playcount": "23",
"@attr": {
"rank": "8"
},
"name": "dissimulator"
}
]

View file

@ -1,20 +0,0 @@
export default [
{
"title": "How to Make a Killing: Blood, Death and Dollars in American Medicine",
"author": "Tom Mueller",
"image": "https://cd-books.b-cdn.net/vfbaoylm8sxmuifsp6y4ifx3p3o3",
"url": "https://app.thestorygraph.com/books/d02f9eec-ca74-419e-a28b-4f59d0e89e01",
"percentage": "86%",
"dateAdded": "2/5/2024, 12:00:00 AM",
"type": "book"
},
{
"author": "Peter Watts",
"title": "Blindsight",
"image": "https://cd-books.b-cdn.net/2e47qqm3giuw0uiexnbsm9egpqst",
"url": "https://app.thestorygraph.com/books/57fd0912-3e02-4a55-b7a8-86f584ecf373",
"percentage": "41%",
"dateAdded": "1/3/2024, 12:00:00 AM",
"type": "book"
}
]

View file

@ -1,55 +0,0 @@
export default [
{
"title": "This website is personal",
"author": "Frills",
"created_at":"2024-02-02T21:10:12.783499+00:00",
"updated_at":"2024-02-03T00:22:28.594852+00:00",
"published_date":1706832000000,
"tags": {
"tech": {
"name": "tech",
"type": "manual",
"created": 1707349350280
},
"share": {
"name": "share",
"type": "manual",
"created": 1707349353085
},
"blogging": {
"name": "blogging",
"type": "manual",
"created": 1707349352274
}
},
"summary": "It is easy to get overwhelmed by the fact that anything you put online can live forever. Even when you evolve and change as a person: your thoughts, your values, your opinions, your past-self still exists in this ephemeral space. That is beautiful and terrifying.\nI've been thinking a lot recently about what I share where on the internet. I sometimes toot consistently and conversationally on Mastodon for a week or so at a time; I post a couple of times a year on Instagram, moreso on stories but even that has petered out a lot; and here on my website I have started holding blog posts up on this pedastal as something that need to be substantial or at least a little bit interesting. Somehow, even here, the lure of professionalism and validation has kicked in.\n\ni want to read your thoughts, your feelings, your perceptions of the world as it's happening around you. romanticize your life; tell me the minute details of your commute—your perception is yours, after all, and i've never experienced it before.\nXandra: Everyo...",
"source_url": "https://frills.dev/blog/070224-this-website-is-personal-girls/",
},
{
"url": "https://read.readwise.io/read/01hp2d8dggjjmgjg8pjxvdwnpz",
"title": "The power to not",
"author": "neatnik.net",
"created_at": "2024-01-30T17:40:08.899912+00:00",
"updated_at": "2024-01-30T21:26:29.469528+00:00",
"published_date": 1706313600000,
"tags": {
"tech": {
"name": "tech",
"type": "manual",
"created": 1707330519410
},
"share": {
"name": "share",
"type": "manual",
"created": 1707330522792
},
"social media": {
"name": "social media",
"type": "manual",
"created": 1707330521543
}
},
"summary": "The urge to engage can be overwhelming.",
"source_url": "https://notes.neatnik.net/2024/01/the-power-to-not",
}
]

View file

@ -1,215 +0,0 @@
export default [
{
"id": 9521296050,
"watched_at": "2024-02-06T14:41:22.000Z",
"action": "checkin",
"type": "movie",
"movie": {
"title": "The Accountant",
"year": 2016,
"ids": {
"trakt": 203309,
"slug": "the-accountant-2016",
"imdb": "tt2140479",
"tmdb": 302946
},
"tagline": "Calculate your choices.",
"overview": "As a math savant uncooks the books for a new client, the Treasury Department closes in on his activities and the body count starts to rise.",
"released": "2016-10-14",
"runtime": 128,
"country": "us",
"trailer": "https://youtube.com/watch?v=0KHOVlEpMyY",
"homepage": "http://www.accountantmovie.com/",
"status": "released",
"rating": 7.72918,
"votes": 30256,
"comment_count": 62,
"updated_at": "2024-02-07T12:06:14.000Z",
"language": "en",
"genres": [
"drama",
"crime",
"thriller"
],
"certification": "R"
}
},
{
"id": 9518530996,
"watched_at": "2024-02-05T00:58:37.000Z",
"action": "watch",
"type": "movie",
"movie": {
"title": "Apocalypse Now",
"year": 1979,
"ids": {
"trakt": 23,
"slug": "apocalypse-now-1979",
"imdb": "tt0078788",
"tmdb": 28
},
"tagline": "This is the end...",
"overview": "At the height of the Vietnam war, Captain Benjamin Willard is sent on a dangerous mission that, officially, \"does not exist, nor will it ever exist.\" His goal is to locate - and eliminate - a mysterious Green Beret Colonel named Walter Kurtz, who has been leading his personal army on illegal guerrilla missions into enemy territory.",
"released": "1979-08-15",
"runtime": 147,
"country": "us",
"trailer": "https://youtube.com/watch?v=9l-ViOOFH-s",
"homepage": "http://www.apocalypsenow.com",
"status": "released",
"rating": 8.22404,
"votes": 10257,
"comment_count": 25,
"updated_at": "2024-02-08T08:05:34.000Z",
"language": "en",
"genres": [
"war",
"drama"
],
"certification": "R"
}
},
{
"id": 9517495292,
"watched_at": "2024-02-04T18:10:40.000Z",
"action": "watch",
"type": "movie",
"movie": {
"title": "10 Cloverfield Lane",
"year": 2016,
"ids": {
"trakt": 214312,
"slug": "10-cloverfield-lane-2016",
"imdb": "tt1179933",
"tmdb": 333371
},
"tagline": "Monsters come in many forms.",
"overview": "After getting in a car accident, a woman is held in a shelter with two men, who claim the outside world is affected by a widespread chemical attack.",
"released": "2016-03-11",
"runtime": 104,
"country": "us",
"trailer": "https://youtube.com/watch?v=yQy-ANhnUpE",
"homepage": "http://www.10cloverfieldlane.com/",
"status": "released",
"rating": 7.23989,
"votes": 24003,
"comment_count": 101,
"updated_at": "2024-02-08T12:37:37.000Z",
"language": "en",
"genres": [
"science-fiction",
"thriller",
"drama",
"horror"
],
"certification": "PG-13"
}
},
{
"id": 9497461700,
"watched_at": "2024-01-26T20:25:58.000Z",
"action": "watch",
"type": "movie",
"movie": {
"title": "Aquaman",
"year": 2018,
"ids": {
"trakt": 193968,
"slug": "aquaman-2018",
"imdb": "tt1477834",
"tmdb": 297802
},
"tagline": "Home Is Calling",
"overview": "Once home to the most advanced civilization on Earth, Atlantis is now an underwater kingdom ruled by the power-hungry King Orm. With a vast army at his disposal, Orm plans to conquer the remaining oceanic people and then the surface world. Standing in his way is Arthur Curry, Orm's half-human, half-Atlantean brother and true heir to the throne.",
"released": "2018-12-21",
"runtime": 143,
"country": "us",
"trailer": "https://youtube.com/watch?v=2wcj6SrX4zw",
"homepage": "https://www.warnerbros.com/movies/aquaman",
"status": "released",
"rating": 7.22762,
"votes": 30766,
"comment_count": 182,
"updated_at": "2024-02-07T08:07:16.000Z",
"language": "en",
"genres": [
"fantasy",
"superhero",
"adventure",
"action"
],
"certification": "PG-13"
}
},
{
"id": 9491909538,
"watched_at": "2024-01-23T23:57:28.000Z",
"action": "watch",
"type": "movie",
"movie": {
"title": "Aquaman and the Lost Kingdom",
"year": 2023,
"ids": {
"trakt": 423775,
"slug": "aquaman-and-the-lost-kingdom-2023",
"imdb": "tt9663764",
"tmdb": 572802
},
"tagline": "The tide is turning.",
"overview": "Black Manta seeks revenge on Aquaman for his father's death. Wielding the Black Trident's power, he becomes a formidable foe. To defend Atlantis, Aquaman forges an alliance with his imprisoned brother. They must protect the kingdom.",
"released": "2023-12-22",
"runtime": 124,
"country": "us",
"trailer": "https://youtube.com/watch?v=UGc5Tzz19UY",
"homepage": "https://www.aquamanmovie.com",
"status": "released",
"rating": 6.4311,
"votes": 4231,
"comment_count": 67,
"updated_at": "2024-02-08T08:06:27.000Z",
"language": "en",
"genres": [
"adventure",
"action",
"fantasy",
"superhero"
],
"certification": "PG-13"
}
},
{
"id": 9480347272,
"watched_at": "2024-01-18T23:17:09.000Z",
"action": "watch",
"type": "movie",
"movie": {
"title": "The Marvels",
"year": 2023,
"ids": {
"trakt": 454832,
"slug": "the-marvels-2023",
"imdb": "tt10676048",
"tmdb": 609681
},
"tagline": "Higher. Further. Faster. Together.",
"overview": "Carol Danvers, aka Captain Marvel, has reclaimed her identity from the tyrannical Kree and taken revenge on the Supreme Intelligence. But unintended consequences see Carol shouldering the burden of a destabilized universe. When her duties send her to an anomalous wormhole linked to a Kree revolutionary, her powers become entangled with that of Jersey City super-fan Kamala Khan, aka Ms. Marvel, and Carols estranged niece, now S.A.B.E.R. astronaut Captain Monica Rambeau. Together, this unlikely trio must team up and learn to work in concert to save the universe.",
"released": "2023-11-10",
"runtime": 105,
"country": "us",
"trailer": "https://youtube.com/watch?v=uwmDH12MAA4",
"homepage": "https://www.marvel.com/movies/the-marvels",
"status": "released",
"rating": 6.27356,
"votes": 5264,
"comment_count": 132,
"updated_at": "2024-02-08T08:06:36.000Z",
"language": "en",
"genres": [
"superhero",
"action",
"adventure",
"science-fiction"
],
"certification": "PG-13"
}
}
]

View file

@ -1,4 +0,0 @@
export default {
"emoji": "🐯",
"content": "You can choose to be kind.",
}

View file

@ -1,302 +0,0 @@
export default [
{
"id": 9525629074,
"watched_at": "2024-02-08T15:02:00.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 2,
"number": 2,
"title": "Be My Number One",
"ids": {
"trakt": 11317749,
"tvdb": 10193559,
"imdb": "tt25399544",
"tmdb": 5062519,
"tvrage": null
}
},
"show": {
"title": "Tokyo Vice",
"year": 2022,
"ids": {
"trakt": 156576,
"slug": "tokyo-vice",
"tvdb": 366624,
"imdb": "tt2887954",
"tmdb": 90296,
"tvrage": null
}
}
},
{
"id": 9525349458,
"watched_at": "2024-02-08T15:01:14.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 2,
"number": 1,
"title": "Don't Ever F**king Miss",
"ids": {
"trakt": 11317721,
"tvdb": 10173398,
"imdb": "tt20875414",
"tmdb": 5062421,
"tvrage": null
}
},
"show": {
"title": "Tokyo Vice",
"year": 2022,
"ids": {
"trakt": 156576,
"slug": "tokyo-vice",
"tvdb": 366624,
"imdb": "tt2887954",
"tmdb": 90296,
"tvrage": null
}
}
},
{
"id": 9525348552,
"watched_at": "2024-02-08T15:00:39.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 2,
"number": 2,
"title": "Sword",
"ids": {
"trakt": 11165210,
"tvdb": 10247899,
"imdb": "tt22060126",
"tmdb": 4968609,
"tvrage": null
}
},
"show": {
"title": "Halo",
"year": 2022,
"ids": {
"trakt": 150109,
"slug": "halo",
"tvdb": 366524,
"imdb": "tt2934286",
"tmdb": 52814,
"tvrage": null
}
}
},
{
"id": 9525059250,
"watched_at": "2024-02-08T14:59:52.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 2,
"number": 1,
"title": "Sanctuary",
"ids": {
"trakt": 11165209,
"tvdb": 10170113,
"imdb": "tt22060096",
"tmdb": 4968592,
"tvrage": null
}
},
"show": {
"title": "Halo",
"year": 2022,
"ids": {
"trakt": 150109,
"slug": "halo",
"tvdb": 366524,
"imdb": "tt2934286",
"tmdb": 52814,
"tvrage": null
}
}
},
{
"id": 9524186036,
"watched_at": "2024-02-08T02:52:24.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 1,
"number": 2,
"title": "Second Date",
"ids": {
"trakt": 11055013,
"tvdb": 10155338,
"imdb": "tt21650512",
"tmdb": 4926319,
"tvrage": null
}
},
"show": {
"title": "Mr. & Mrs. Smith",
"year": 2024,
"ids": {
"trakt": 173650,
"slug": "mr-mrs-smith-2024",
"tvdb": 396773,
"imdb": "tt14044212",
"tmdb": 118642,
"tvrage": null
}
}
},
{
"id": 9523446431,
"watched_at": "2024-02-07T15:01:33.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 1,
"number": 1,
"title": "First Date",
"ids": {
"trakt": 4810701,
"tvdb": 8216044,
"imdb": "tt14199656",
"tmdb": 2726037,
"tvrage": null
}
},
"show": {
"title": "Mr. & Mrs. Smith",
"year": 2024,
"ids": {
"trakt": 173650,
"slug": "mr-mrs-smith-2024",
"tvdb": 396773,
"imdb": "tt14044212",
"tmdb": 118642,
"tvrage": null
}
}
},
{
"id": 9523322722,
"watched_at": "2024-02-07T14:59:21.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 1,
"number": 6,
"title": "Beehive",
"ids": {
"trakt": 10934939,
"tvdb": 10068291,
"imdb": "tt21107292",
"tmdb": 4785721,
"tvrage": null
}
},
"show": {
"title": "Criminal Record",
"year": 2024,
"ids": {
"trakt": 196417,
"slug": "criminal-record",
"tvdb": 421495,
"imdb": "tt21088136",
"tmdb": 204490,
"tvrage": null
}
}
},
{
"id": 9520276837,
"watched_at": "2024-02-05T15:00:41.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 49,
"number": 11,
"title": "February 3 - Ayo Edebiri",
"ids": {
"trakt": 11375525,
"tvdb": null,
"imdb": null,
"tmdb": 5099959,
"tvrage": null
}
},
"show": {
"title": "Saturday Night Live",
"year": 1975,
"ids": {
"trakt": 1656,
"slug": "saturday-night-live",
"tvdb": 76177,
"imdb": "tt0072562",
"tmdb": 1667,
"tvrage": null
}
}
},
{
"id": 9519545755,
"watched_at": "2024-02-05T14:53:00.000Z",
"action": "watch",
"type": "episode",
"episode": {
"season": 1,
"number": 8,
"title": "We Shall Live Forever",
"ids": {
"trakt": 883344,
"tvdb": 4460471,
"imdb": "tt2356588",
"tmdb": 876837,
"tvrage": null
}
},
"show": {
"title": "Banshee",
"year": 2013,
"ids": {
"trakt": 41522,
"slug": "banshee",
"tvdb": 259765,
"imdb": "tt2017109",
"tmdb": 41727,
"tvrage": null
}
}
},
{
"id": 9519471765,
"watched_at": "2024-02-05T13:56:28.000Z",
"action": "checkin",
"type": "episode",
"episode": {
"season": 1,
"number": 7,
"title": "Behold a Pale Rider",
"ids": {
"trakt": 883343,
"tvdb": 4460470,
"imdb": "tt2371798",
"tmdb": 876836,
"tvrage": null
}
},
"show": {
"title": "Banshee",
"year": 2013,
"ids": {
"trakt": 41522,
"slug": "banshee",
"tvdb": 259765,
"imdb": "tt2017109",
"tmdb": 41727,
"tvrage": null
}
}
},
]

View file

@ -1,5 +1,4 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import LinksMock from './json/mocks/links.js'
export default async function () {
const API_TOKEN_READWISE = process.env.API_TOKEN_READWISE
@ -17,20 +16,16 @@ export default async function () {
}
})
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
Authorization: `Token ${API_TOKEN_READWISE}`,
},
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
Authorization: `Token ${API_TOKEN_READWISE}`,
},
}).catch()
const data = await res
return formatLinkData(data['results']).filter((link) => link.tags.includes('share'))
} else {
return formatLinkData(LinksMock)
}
},
}).catch()
const data = await res
return formatLinkData(data['results']).filter((link) => link.tags.includes('share'))
}

View file

@ -1,5 +1,4 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import MoviesMock from './json/mocks/movies.js'
export default async function () {
const TV_KEY = process.env.API_KEY_TRAKT
@ -19,34 +18,30 @@ export default async function () {
return movie;
})
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
'Content-Type': 'application/json',
'trakt-api-version': 2,
'trakt-api-key': TV_KEY,
},
},
}).catch()
const data = await res
const movies = formatMovieData(data)
for (const movie of movies) {
const tmdbId = movie['tmdbId']
const tmdbUrl = `https://api.themoviedb.org/3/movie/${tmdbId}?api_key=${MOVIEDB_KEY}`
const tmdbRes = EleventyFetch(tmdbUrl, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
'Content-Type': 'application/json',
'trakt-api-version': 2,
'trakt-api-key': TV_KEY,
},
},
}).catch()
const data = await res
const movies = formatMovieData(data)
for (const movie of movies) {
const tmdbId = movie['tmdbId']
const tmdbUrl = `https://api.themoviedb.org/3/movie/${tmdbId}?api_key=${MOVIEDB_KEY}`
const tmdbRes = EleventyFetch(tmdbUrl, {
duration: '1h',
type: 'json',
})
const tmdbData = await tmdbRes
const posterPath = tmdbData['poster_path']
movie.image = `https://cd-movies.b-cdn.net/t/p/w500${posterPath}`
}
return movies;
} else {
return formatMovieData(MoviesMock)
})
const tmdbData = await tmdbRes
const posterPath = tmdbData['poster_path']
movie.image = `https://cd-movies.b-cdn.net/t/p/w500${posterPath}`
}
return movies;
}

View file

@ -1,16 +1,11 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import StatusMock from './json/mocks/status.js'
export default async function () {
const url = 'https://api.omg.lol/address/cory/statuses/'
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch()
const status = await res
return status.response['statuses'][0]
} else {
return StatusMock
}
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
}).catch()
const status = await res
return status.response['statuses'][0]
}

View file

@ -1,11 +1,9 @@
import EleventyFetch from '@11ty/eleventy-fetch'
import TvMock from './json/mocks/tv.js'
export default async function () {
const TV_KEY = process.env.API_KEY_TRAKT
const MOVIEDB_KEY = process.env.API_KEY_MOVIEDB
const url = 'https://api.trakt.tv/users/cdransf/history/shows?page=1&limit=75'
let episodes
const formatEpisodeData = (shows) => {
const episodeData = []
const startingEpisodes = []
@ -61,33 +59,30 @@ export default async function () {
return episodeData.reverse()
}
if (process.env.ELEVENTY_PRODUCTION) {
const res = EleventyFetch(url, {
const res = EleventyFetch(url, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
'Content-Type': 'application/json',
'trakt-api-version': 2,
'trakt-api-key': TV_KEY,
},
},
}).catch()
const shows = await res
const episodes = formatEpisodeData(shows)
for (const episode of episodes) {
const tmdbId = episode['tmdbId']
const tmdbUrl = `https://api.themoviedb.org/3/tv/${tmdbId}?api_key=${MOVIEDB_KEY}`
const tmdbRes = EleventyFetch(tmdbUrl, {
duration: '1h',
type: 'json',
fetchOptions: {
headers: {
'Content-Type': 'application/json',
'trakt-api-version': 2,
'trakt-api-key': TV_KEY,
},
},
}).catch()
const shows = await res
episodes = formatEpisodeData(shows)
for (const episode of episodes) {
const tmdbId = episode['tmdbId']
const tmdbUrl = `https://api.themoviedb.org/3/tv/${tmdbId}?api_key=${MOVIEDB_KEY}`
const tmdbRes = EleventyFetch(tmdbUrl, {
duration: '1h',
type: 'json',
})
const tmdbData = await tmdbRes
const posterPath = tmdbData['poster_path']
episode.image = `https://cd-movies.b-cdn.net/t/p/w500${posterPath}`
}
} else {
episodes = formatEpisodeData(TvMock)
})
const tmdbData = await tmdbRes
const posterPath = tmdbData['poster_path']
episode.image = `https://cd-movies.b-cdn.net/t/p/w500${posterPath}`
}
return episodes;
}