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 } }