From 360465395a42ffef8a95eedb40d3ed8060317a58 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 25 Dec 2025 19:19:09 +0000 Subject: [PATCH] updated getLetterboxdActivity to conditionally include image in returned text --- utils.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utils.js b/utils.js index e948db7..30a5c33 100644 --- a/utils.js +++ b/utils.js @@ -102,10 +102,16 @@ export async function getLetterboxdActivity(username, showImage = true) { const title = item.querySelector('title').textContent const link = item.querySelector('link').textContent.trim() const cleanTitle = markdownCharEscape(title) - const image = item.querySelector('description > img').src - const text = !showImage - ? cleanTitle - : `${cleanTitle} ![${cleanTitle}](${image})` + + let text = cleanTitle + if (showImage) { + // Parse CDATA content as HTML to extract image + const description = item.querySelector('description').textContent + const imgMatch = description.match(/]+src="([^"]+)"/) + const image = imgMatch ? imgMatch[1] : null + text = image ? `${cleanTitle} ![${cleanTitle}](${image})` : cleanTitle + } + return { text, url: link } }