mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 03:56:19 +00:00
added parsing of image_url and test
This commit is contained in:
18
lib/rss.js
18
lib/rss.js
@@ -48,13 +48,17 @@ function ifTruePush(bool, array, data) {
|
||||
function generateXML (data){
|
||||
// todo: xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
|
||||
|
||||
var channel = [
|
||||
{ title: { _cdata: data.title } },
|
||||
{ description: { _cdata: data.description || data.title } },
|
||||
{ link: data.site_url || 'http://github.com/dylan/node-rss' },
|
||||
{ generator: 'NodeJS RSS Module' },
|
||||
{ lastBuildDate: new Date().toGMTString() }
|
||||
];
|
||||
var channel = [];
|
||||
channel.push({ title: { _cdata: data.title } });
|
||||
channel.push({ description: { _cdata: data.description || data.title } });
|
||||
channel.push({ link: data.site_url || 'http://github.com/dylan/node-rss' });
|
||||
// image_url set?
|
||||
if (data.image_url) {
|
||||
channel.push({ image: [ {url: data.image_url}, {title: data.title}, {link: data.site_url} ] });
|
||||
}
|
||||
channel.push({ generator: 'NodeJS RSS Module' });
|
||||
channel.push({ lastBuildDate: new Date().toGMTString() });
|
||||
|
||||
ifTruePush(data.feed_url, channel, { 'atom:link': { _attr: { href: data.feed_url, rel: 'self', type: 'application/rss+xml' } } });
|
||||
// { updated: new Date().toGMTString() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user