booklogr support
This commit is contained in:
parent
03ca72d917
commit
940627fb07
2 changed files with 16 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import {
|
|||
getJsonFeedItemTitle,
|
||||
getLetterboxdActivity,
|
||||
getMalojaScrobble,
|
||||
getReadingBooklogr,
|
||||
getRSSItemTitle,
|
||||
getTraktEpisode,
|
||||
markdownLinkRegex,
|
||||
|
|
@ -32,6 +33,12 @@ export const items = [
|
|||
regex: markdownLinkRegex('scrobbles.melkat.dev'),
|
||||
getLatest: async () => getMalojaScrobble('https://scrobbles.melkat.dev'),
|
||||
},
|
||||
{
|
||||
id: 'books',
|
||||
regex: markdownLinkRegex('reads.melkat.dev/profile/melanie'),
|
||||
getLatest: async () =>
|
||||
getReadingBooklogr('https://reads-api.melkat.dev', 'melanie'),
|
||||
},
|
||||
{
|
||||
id: 'letterboxd',
|
||||
regex: markdownLinkRegex('letterboxd.com/zicklepop'),
|
||||
|
|
|
|||
9
utils.js
9
utils.js
|
|
@ -98,3 +98,12 @@ export async function getTraktEpisode(username, id) {
|
|||
const cleanTitle = markdownCharEscape(title)
|
||||
return `${cleanTitle} `
|
||||
}
|
||||
|
||||
export async function getReadingBooklogr(booklogrUrl, booklogrUser) {
|
||||
const res = await fetch(`${booklogrUrl}/v1/profiles/${booklogrUser}`)
|
||||
const data = await res.json()
|
||||
const books = data.books.filter(
|
||||
({ reading_status }) => reading_status === 'Currently reading',
|
||||
)
|
||||
return books.map(({ title }) => title).join(', ')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue