2016-03-16 00:16:49 +00:00
|
|
|
var outputFile = 'lifestyle', RssBraider = require('rss-braider'), fs = require(
|
|
|
|
'fs'), ejs = require('ejs'), read = require('fs').readFileSync, join = require(
|
|
|
|
'path').join, str = read(join(__dirname, '/templates/rss.ejs'),
|
|
|
|
'utf8'), feeds = {};
|
2015-07-20 15:56:35 +00:00
|
|
|
|
|
|
|
// Pull feeds from config files: ,
|
2016-03-15 13:20:34 +00:00
|
|
|
// feeds.simple_test_feed = require("./config/feed").feed;
|
|
|
|
// Or define in-line
|
2015-07-20 15:56:35 +00:00
|
|
|
feeds.simple_test_feed = {
|
2017-10-01 17:25:17 +00:00
|
|
|
'feed_name': 'feed',
|
|
|
|
'default_count': 1,
|
|
|
|
'no_cdata_fields': [], // Don't wrap these fields in CDATA tags
|
|
|
|
'meta': {
|
|
|
|
'title': 'Lifestyle',
|
|
|
|
'description': 'Combined Lifestyle Feed',
|
2016-03-16 00:16:49 +00:00
|
|
|
'site_url': 'http://pipes.silvrtree.co.uk/lifestyle.xml'
|
2017-10-01 17:25:17 +00:00
|
|
|
},
|
|
|
|
'plugins': ['filter_last_week', 'fix_images', 'fix_scripts'],
|
2018-03-04 16:39:52 +00:00
|
|
|
'sources': [{'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds2.feedburner.com%2Facquire'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.askmen.com%2Fstyle.rss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.askmen.com%2Ffine_living.rss'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.askmen.com%2Fmoney.rss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.dmarge.com%2Ffeed'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.esquire.com%2Frss%2Fall.xml'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2Fgearpatrol'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2Fkinowear'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensfitness.co.uk%2Ffeeds%2Fall'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2FTheArtOfManliness'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.trunkclub.com%2Fblog%2Ffeed'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2Facontinuouslean%2F'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.fashionbeans.com%2Ffeed%2F'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2FMensFlair%3Fformat%3Dxml'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2FTheChoosyBeggar'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.valetmag.com%2Fdistribution%2Frss_all.xml'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fputthison.com%2Frss'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fdieworkwear.com%2Frss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fmenofhabit.tumblr.com%2Frss'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.hodinkee.com%2Fblog%2Frss.xml'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2Ffirstinwatches'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds2.feedburner.com%2Fprimermagazine%2FotzU'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fchrisguillebeau.com%2F3x5%2Ffeed%2F'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2FTheAwesomer'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fbondclothes.blogspot.com%2Ffeeds%2Fposts%2Fdefault'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Faffordablebond007.tumblr.com%2Frss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fthecozyspace.tumblr.com%2Frss'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.gentlemansgazette.com%2Ffeed%2F'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2Fwellspent'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fhespokestyle.com%2Ffeed%2F'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Feffortlessgent.com%2Ffeed%2F'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/https%3A%2F%2Ffeeds.feedburner.com%2Fthisfits'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fgeorgehahn.com%2Ffeed%2F'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensjournal.com%2Fservices%2Frss%2Fgear'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensjournal.com%2Fservices%2Frss%2Ffood-drink'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensjournal.com%2Fservices%2Frss%2Ftravel'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensjournal.com%2Fservices%2Frss%2Fadventure'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensjournal.com%2Fservices%2Frss%2Fhealth-fitness'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mensjournal.com%2Fservices%2Frss%2Fstyle'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/https%3A%2F%2Ffeeds.feedburner.com%2Funcrate'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/https%3A%2F%2Ffeeds.feedburner.com%2FManOfMany'}, {
|
2017-10-01 17:25:17 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Ffeeds.feedburner.com%2Fnymag%2Fvulture'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.mantelligence.com%2Ffeed%2F'}]
|
2015-07-20 15:56:35 +00:00
|
|
|
};
|
|
|
|
var braider_options = {
|
2016-03-16 00:16:49 +00:00
|
|
|
feeds: feeds,
|
2017-10-01 17:25:17 +00:00
|
|
|
indent: ' ',
|
|
|
|
date_sort_order: 'desc', // Newest first
|
|
|
|
log_level: 'warn',
|
2016-03-16 00:16:49 +00:00
|
|
|
dedupe_fields: ['link', 'guid'],
|
2017-10-01 17:25:17 +00:00
|
|
|
plugins_directories: [__dirname + '/plugins/']
|
2015-07-20 15:56:35 +00:00
|
|
|
};
|
|
|
|
var rss_braider = RssBraider.createClient(braider_options);
|
|
|
|
|
2016-03-15 13:20:34 +00:00
|
|
|
// Override logging level (debug, info, warn, err, off)
|
2016-02-12 13:10:16 +00:00
|
|
|
//rss_braider.logger.level('off');
|
2015-07-20 15:56:35 +00:00
|
|
|
|
2017-10-01 17:25:17 +00:00
|
|
|
rss_braider.processFeed('simple_test_feed', 'json', function (err, data) {
|
2016-03-16 00:16:49 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-21 09:50:51 +00:00
|
|
|
|
2016-03-16 00:16:49 +00:00
|
|
|
var j = JSON.parse(data);
|
|
|
|
var ejsOutput = ejs.compile(str)(j);
|
2015-07-31 10:49:19 +00:00
|
|
|
|
2017-10-01 17:25:17 +00:00
|
|
|
fs.writeFile(__dirname + '/dist/' + outputFile + '.json',
|
2016-03-16 00:16:49 +00:00
|
|
|
data,
|
2017-10-01 17:25:17 +00:00
|
|
|
function (err) {
|
2016-03-16 00:16:49 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-27 12:52:34 +00:00
|
|
|
|
2017-10-01 17:25:17 +00:00
|
|
|
console.log('The file was saved!');
|
2015-07-27 12:52:34 +00:00
|
|
|
});
|
|
|
|
|
2017-10-01 17:25:17 +00:00
|
|
|
fs.writeFile(__dirname + '/dist/' + outputFile + '.html',
|
2016-03-16 00:16:49 +00:00
|
|
|
ejsOutput,
|
2017-10-01 17:25:17 +00:00
|
|
|
function (err) {
|
2015-07-21 09:50:51 +00:00
|
|
|
|
2016-03-16 00:16:49 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-21 09:50:51 +00:00
|
|
|
|
2017-10-01 17:25:17 +00:00
|
|
|
console.log('The file was saved!');
|
2015-07-31 11:47:21 +00:00
|
|
|
});
|
2015-07-21 09:50:51 +00:00
|
|
|
});
|
|
|
|
|
2015-07-31 12:10:53 +00:00
|
|
|
/*
|
2016-03-16 00:16:49 +00:00
|
|
|
rss_braider.processFeed('simple_test_feed', 'rss', function (err, data) {
|
2015-07-31 12:10:04 +00:00
|
|
|
|
2016-03-16 00:16:49 +00:00
|
|
|
fs.writeFile(__dirname + "/html/" + outputFile + ".xml", data, function (err) {
|
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-20 15:56:35 +00:00
|
|
|
|
2016-03-16 00:16:49 +00:00
|
|
|
console.log("The file was saved!");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|