add enclosure element

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

View File

@ -51,6 +51,13 @@ module.exports = function() {
if(is_self_link)
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>`
items += `
@ -61,6 +68,7 @@ module.exports = function() {
<domain>${link.domain}</domain>
<id>${link.id}</id>
<thumbnail>${thumbnail}</thumbnail>
<enclosure length="0" type="${thumb_mime}" url="${thumbnail}" />
<link>${link.permalink}</link>
<url>${link.url}</url>
<description><![CDATA[${unescape(link.selftext_html)}${append_desc_html}]]></description>