Skip to content

Commit

Permalink
Added check for image at media:thumbnail (#7)
Browse files Browse the repository at this point in the history
* Added IMAGES option
* Updated readme
* Moved imageTypes to top of file
* Compiled dist, updated readme
* Added check for media:thumbnail outside of media:group
  • Loading branch information
dalezak authored Jul 19, 2024
1 parent b0ce28c commit 1dbe113
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';
Expand Down
2 changes: 1 addition & 1 deletion process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';
Expand Down

0 comments on commit 1dbe113

Please sign in to comment.