updated some.pics integration
This commit is contained in:
parent
88720c7269
commit
c712c387ae
4 changed files with 73 additions and 22 deletions
12
index.js
12
index.js
|
|
@ -10,6 +10,7 @@ import {
|
|||
getMalojaScrobble,
|
||||
getMastodonPost,
|
||||
getRSSItemTitle,
|
||||
getSomePicsPost,
|
||||
getSourceTubeActivity,
|
||||
getSteamRecentlyPlayed,
|
||||
getTraktEpisode,
|
||||
|
|
@ -23,6 +24,7 @@ const feedHandlers = {
|
|||
rss: getRSSItemTitle,
|
||||
atom: getAtomFeed,
|
||||
json: getJsonFeedItemTitle,
|
||||
'some.pics': getSomePicsPost,
|
||||
'source.tube': getSourceTubeActivity,
|
||||
mastodon: getMastodonPost,
|
||||
letterboxd: getLetterboxdActivity,
|
||||
|
|
@ -79,9 +81,13 @@ export default async function now() {
|
|||
}
|
||||
|
||||
// generic handlers expect just feedUrl string, special handlers expect config object
|
||||
const handlerParam = ['rss', 'atom', 'json', 'maloja'].includes(
|
||||
item.feedType,
|
||||
)
|
||||
const handlerParam = [
|
||||
'rss',
|
||||
'atom',
|
||||
'json',
|
||||
'maloja',
|
||||
'some.pics',
|
||||
].includes(item.feedType)
|
||||
? feedUrl
|
||||
: { ...item, feedUrl }
|
||||
const latest = await handler(handlerParam)
|
||||
|
|
|
|||
|
|
@ -6,49 +6,58 @@
|
|||
<i class="fa-brands fa-lastfm"></i> I listened to this<br>
|
||||
<a href="https://www.last.fm/user/lookathimthere" style="color: #a6e3a1 !important;">lastfm</a>
|
||||
</div>
|
||||
<div style="background: rgba(250, 179, 135, 0.15); padding: 1rem; border: 4px solid #fab387; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(250, 179, 135, 0.15); padding: 1rem; border: 4px solid #fab387; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
<i class="fa-solid fa-tv"></i> I watched this episode<br>
|
||||
<a href="https://trakt.tv/episodes" style="color: #fab387 !important;">trakt-episode</a>
|
||||
</div>
|
||||
<img src="trakt-episode-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
<img src="trakt-episode-image"
|
||||
style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
</div>
|
||||
<div style="background: rgba(250, 179, 135, 0.15); padding: 1rem; border: 4px solid #fab387; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(250, 179, 135, 0.15); padding: 1rem; border: 4px solid #fab387; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
<i class="fa-solid fa-film"></i> I watched this movie<br>
|
||||
<a href="https://trakt.tv/movies/" style="color: #fab387 !important;">trakt-movie</a>
|
||||
</div>
|
||||
<img src="trakt-movie-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
<img src="trakt-movie-image"
|
||||
style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
</div>
|
||||
<div style="background: rgba(243, 139, 168, 0.15); padding: 1rem; border: 4px solid #f38ba8; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(243, 139, 168, 0.15); padding: 1rem; border: 4px solid #f38ba8; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
<i class="fa-solid omg-icon omg-letterboxd"></i> I rated this<br>
|
||||
<a href="https://letterboxd.com/STFUDonny" style="color: #f38ba8 !important;">letterboxd</a>
|
||||
</div>
|
||||
<img src="letterboxd-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
</div>
|
||||
<div style="background: rgba(180, 190, 254, 0.15); padding: 1rem; border: 4px solid #b4befe; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(180, 190, 254, 0.15); padding: 1rem; border: 4px solid #b4befe; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
<i class="fa-solid fa-book"></i> I'm reading this<br>
|
||||
<a href="https://hardcover.app" style="color: #b4befe !important;">hardcover</a>
|
||||
</div>
|
||||
<img src="hardcover-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
</div>
|
||||
<div style="background: rgba(137, 180, 250, 0.15); padding: 1rem; border: 4px solid #89b4fa; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(137, 180, 250, 0.15); padding: 1rem; border: 4px solid #89b4fa; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
<i class="fa-brands fa-steam"></i> I played this<br>
|
||||
<a href="https://store.steampowered.com" style="color: #89b4fa !important;">steam</a>
|
||||
</div>
|
||||
<img src="steam-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
</div>
|
||||
<div style="background: rgba(148, 226, 213, 0.15); padding: 1rem; border: 4px solid #94e2d5; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(148, 226, 213, 0.15); padding: 1rem; border: 4px solid #94e2d5; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
I shared this photo<br>
|
||||
<a href="https://dylan.some.pics" style="color: #94e2d5 !important;">some.pics</a>
|
||||
</div>
|
||||
<img src="some.pics-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||
</div>
|
||||
<div style="background: rgba(249, 226, 175, 0.15); padding: 1rem; border: 4px solid #f9e2af; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div
|
||||
style="background: rgba(249, 226, 175, 0.15); padding: 1rem; border: 4px solid #f9e2af; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="text-align: left;">
|
||||
I wrote this<br>
|
||||
<a href="https://dylan.weblog.lol" style="color: #f9e2af !important;">weblog</a>
|
||||
|
|
@ -62,18 +71,33 @@
|
|||
</div>
|
||||
|
||||
<h5>{last-updated}</h5>
|
||||
<p style="font-size:0.825em !important;">Want your own automatically updated Now page? Check out <a href="https://source.tube/dylan/now-updater">now-updater</a>.</p>
|
||||
<p style="font-size:0.825em !important;">Want your own automatically updated Now page? Check out <a
|
||||
href="https://source.tube/dylan/now-updater">now-updater</a>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="badges">
|
||||
<a href="https://people.pledge.party"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596198/people_pledge_badge_party_pink_cream_88x31_uyqfgg.png" alt="People Pledge 88x31 Badge"></a>
|
||||
<a href="https://social.lol/@dylan"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596200/mastodon_ek8b0l.gif" alt="Follow me on Mastodon - @dylan@social.lol 88x31 Badge"></a>
|
||||
<a href="https://source.tube/dylan/now-updater"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596194/badly-hand-coded-88x31_txfsai.gif" alt="Badly Hand-Coded and Proud 88x31 Badge"></a>
|
||||
<a href="https://www.linux.org/pages/download/"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596863/gnu-linux_ktn9ec.gif" alt="omg.lol 88x31 Badge"></a>
|
||||
<a href="https://annas-archive.li"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596623/freencool_mdunpb.gif" alt="Anna's Archive 88x31 Badge"></a>
|
||||
<a href="https://privacybadger.org"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596864/internetprivacy_tdutsi.gif" alt="Internet Privacy 88x31 Badge"></a>
|
||||
<a href="https://home.omg.lol/referred-by/dylan"><img src="https://res.cloudinary.com/dkubc5dik/image/upload/omglol-88x31_rrl1fj.svg" alt="omg.lol 88x31 Badge"></a>
|
||||
<a href="https://people.pledge.party"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596198/people_pledge_badge_party_pink_cream_88x31_uyqfgg.png"
|
||||
alt="People Pledge 88x31 Badge"></a>
|
||||
<a href="https://social.lol/@dylan"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596200/mastodon_ek8b0l.gif"
|
||||
alt="Follow me on Mastodon - @dylan@social.lol 88x31 Badge"></a>
|
||||
<a href="https://source.tube/dylan/now-updater"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596194/badly-hand-coded-88x31_txfsai.gif"
|
||||
alt="Badly Hand-Coded and Proud 88x31 Badge"></a>
|
||||
<a href="https://www.linux.org/pages/download/"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596863/gnu-linux_ktn9ec.gif"
|
||||
alt="omg.lol 88x31 Badge"></a>
|
||||
<a href="https://annas-archive.li"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596623/freencool_mdunpb.gif"
|
||||
alt="Anna's Archive 88x31 Badge"></a>
|
||||
<a href="https://privacybadger.org"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/v1766596864/internetprivacy_tdutsi.gif"
|
||||
alt="Internet Privacy 88x31 Badge"></a>
|
||||
<a href="https://home.omg.lol/referred-by/dylan"><img
|
||||
src="https://res.cloudinary.com/dkubc5dik/image/upload/omglol-88x31_rrl1fj.svg"
|
||||
alt="omg.lol 88x31 Badge"></a>
|
||||
</div>
|
||||
|
||||
<h3><a href="https://dylan.omg.lol">Back to my omg.lol page!</a></h3>
|
||||
<h3><a href="https://dylan.omg.lol">Back to my omg.lol page!</a></h3>
|
||||
|
|
@ -17,7 +17,7 @@ export const services = [
|
|||
isActive: true,
|
||||
userId: 'dylan', // your omg.lol username
|
||||
feedUrlTemplate: 'https://{userId}.some.pics/rss',
|
||||
feedType: 'rss',
|
||||
feedType: 'some.pics',
|
||||
},
|
||||
|
||||
// ========================================================================
|
||||
|
|
|
|||
21
utils.js
21
utils.js
|
|
@ -87,6 +87,27 @@ export async function getJsonFeedItemTitle(feedUrl, showImage = true) {
|
|||
return { text: title, url, image: showImage ? image : null }
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// omg.lol services
|
||||
// ========================================================================
|
||||
|
||||
// some.pics rss parser - extracts image from cdata description
|
||||
export async function getSomePicsPost(feedUrl) {
|
||||
const res = await fetch(feedUrl)
|
||||
const data = await res.text()
|
||||
const dom = new JSDOM(data, { contentType: 'text/xml' })
|
||||
const item = dom.window.document.querySelector('item')
|
||||
const title = item.querySelector('title').textContent
|
||||
const link = item.querySelector('link').textContent.trim()
|
||||
|
||||
// extract image from cdata description
|
||||
const description = item.querySelector('description').textContent
|
||||
const imgMatch = description.match(/<img[^>]+src="([^"]+)"/)
|
||||
const image = imgMatch ? imgMatch[1] : null
|
||||
|
||||
return { text: title, url: link, image }
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// music
|
||||
// ========================================================================
|
||||
|
|
|
|||
Loading…
Reference in a new issue