From 1dbe113b72ce7f89278ec42d559844fc845ed9dd Mon Sep 17 00:00:00 2001 From: Dale Zak Date: Fri, 19 Jul 2024 03:27:54 -0600 Subject: [PATCH] Added check for image at media:thumbnail (#7) * Added IMAGES option * Updated readme * Moved imageTypes to top of file * Compiled dist, updated readme * Added check for media:thumbnail outside of media:group --- dist/index.js | 2 +- process.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 65c66ef..3e72bba 100644 --- a/dist/index.js +++ b/dist/index.js @@ -58188,7 +58188,7 @@ const generateMarkdown = (template, entry) => { const description = entry.summary?.[0] || content.replace(/(<([^>]+)>)/gi, "").split(" ").splice(0, 50).join(" ") || ''; const author = entry.author?.[0]?.name?.[0] || entry['author']?.[0]?.name?.[0] || entry['dc:creator']?.[0] || 'Unknown Author'; const video = entry['media:group']?.[0]?.['media:content']?.[0]?.$?.url || ''; - const image = entry['media:group']?.[0]?.['media:thumbnail']?.[0]?.$.url || ''; + const image = entry['media:group']?.[0]?.['media:thumbnail']?.[0]?.$.url || entry['media:thumbnail']?.[0]?.$.url || ''; const images = (entry['enclosure'] || entry['media:content'])?.filter(e => imageTypes.includes(e.$['type']))?.map(e => e.$.url) || []; const categories = entry.category || []; const views = entry['media:group']?.[0]?.['media:community']?.[0]?.['media:statistics']?.[0]?.$.views || ''; diff --git a/process.js b/process.js index c03d537..031fae6 100644 --- a/process.js +++ b/process.js @@ -24,7 +24,7 @@ const generateMarkdown = (template, entry) => { const description = entry.summary?.[0] || content.replace(/(<([^>]+)>)/gi, "").split(" ").splice(0, 50).join(" ") || ''; const author = entry.author?.[0]?.name?.[0] || entry['author']?.[0]?.name?.[0] || entry['dc:creator']?.[0] || 'Unknown Author'; const video = entry['media:group']?.[0]?.['media:content']?.[0]?.$?.url || ''; - const image = entry['media:group']?.[0]?.['media:thumbnail']?.[0]?.$.url || ''; + const image = entry['media:group']?.[0]?.['media:thumbnail']?.[0]?.$.url || entry['media:thumbnail']?.[0]?.$.url || ''; const images = (entry['enclosure'] || entry['media:content'])?.filter(e => imageTypes.includes(e.$['type']))?.map(e => e.$.url) || []; const categories = entry.category || []; const views = entry['media:group']?.[0]?.['media:community']?.[0]?.['media:statistics']?.[0]?.$.views || '';