add enclosure element

This commit is contained in:
teddit 2021-01-01 19:34:40 +01:00
parent 5ca2011786
commit e49d6e4917

View File

@ -50,6 +50,13 @@ module.exports = function() {
if(is_self_link) if(is_self_link)
link.url = link.permalink link.url = link.permalink
let thumb_mime = ''
let ext = thumbnail.split('.').pop()
if(ext === 'png')
thumb_mime = 'image/png'
else
thumb_mime = 'image/jpeg'
let append_desc_html = `<br/><a href="${link.url}">[link]</a> <a href="${link.permalink}">[comments]</a>` let append_desc_html = `<br/><a href="${link.url}">[link]</a> <a href="${link.permalink}">[comments]</a>`
@ -61,6 +68,7 @@ module.exports = function() {
<domain>${link.domain}</domain> <domain>${link.domain}</domain>
<id>${link.id}</id> <id>${link.id}</id>
<thumbnail>${thumbnail}</thumbnail> <thumbnail>${thumbnail}</thumbnail>
<enclosure length="0" type="${thumb_mime}" url="${thumbnail}" />
<link>${link.permalink}</link> <link>${link.permalink}</link>
<url>${link.url}</url> <url>${link.url}</url>
<description><![CDATA[${unescape(link.selftext_html)}${append_desc_html}]]></description> <description><![CDATA[${unescape(link.selftext_html)}${append_desc_html}]]></description>