2015-07-21 09:50:51 +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'),
|
2015-07-20 15:56:35 +00:00
|
|
|
feeds = {};
|
|
|
|
|
|
|
|
// Pull feeds from config files: ,
|
|
|
|
// feeds.simple_test_feed = require("./config/feed").feed;
|
|
|
|
// Or define in-line
|
|
|
|
feeds.simple_test_feed = {
|
2015-08-14 09:55:39 +00:00
|
|
|
"feed_name": "feed",
|
|
|
|
"default_count": 1,
|
|
|
|
"no_cdata_fields": [], // Don't wrap these fields in CDATA tags
|
|
|
|
"meta": {
|
2015-07-20 15:56:35 +00:00
|
|
|
"title": "Lifestyle",
|
|
|
|
"description": "Combined Lifestyle Feed",
|
2015-07-20 21:25:42 +00:00
|
|
|
'site_url': 'http://pipes.silvrtree.co.uk/lifestyle.xml'
|
2015-07-20 15:56:35 +00:00
|
|
|
},
|
2016-01-22 16:35:47 +00:00
|
|
|
"plugins": ['filter_last_week', 'fix_images', 'fix_scripts'],
|
2015-08-14 09:55:39 +00:00
|
|
|
"sources": [{
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds2.feedburner.com/acquire"
|
2015-07-20 15:56:35 +00:00
|
|
|
},
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-07-20 15:56:35 +00:00
|
|
|
{
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.fhm.com/category/style/feed"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.askmen.com/style.rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.askmen.com/fine_living.rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.askmen.com/money.rss"
|
|
|
|
}
|
|
|
|
/*,
|
|
|
|
{
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count" : 100,
|
|
|
|
"feed_url" : "http://abetterguy.com/feed/"
|
|
|
|
}*/
|
|
|
|
,
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-07-20 15:56:35 +00:00
|
|
|
{
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.dmarge.com/feed"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.esquire.com/rss/all.xml"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/gearpatrol"
|
2015-07-20 15:56:35 +00:00
|
|
|
},
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-07-20 15:56:35 +00:00
|
|
|
{
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.getkempt.com/rss.xml"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/kinowear"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.mensfitness.co.uk/feeds/all"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/TheArtOfManliness"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.trunkclub.com/blog/feed"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/acontinuouslean/"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.fashionbeans.com/feed/"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/MensFlair?format=xml"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/TheChoosyBeggar"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.valetmag.com/distribution/rss_all.xml"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://putthison.com/rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://dieworkwear.com/rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://menofhabit.tumblr.com/rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://www.hodinkee.com/blog/rss.xml"
|
2016-01-22 16:35:47 +00:00
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/firstinwatches"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds2.feedburner.com/primermagazine/otzU"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://chrisguillebeau.com/3x5/feed/"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/TheAwesomer"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://bondclothes.blogspot.com/feeds/posts/default"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://affordablebond007.tumblr.com/rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://thecozyspace.tumblr.com/rss"
|
|
|
|
}, {
|
2015-07-20 21:25:42 +00:00
|
|
|
|
2015-08-14 09:55:39 +00:00
|
|
|
"count": 100,
|
2016-01-22 16:35:47 +00:00
|
|
|
"feed_url": "http://www.gentlemansgazette.com/feed/"
|
|
|
|
}, {
|
|
|
|
|
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://feeds.feedburner.com/wellspent"
|
|
|
|
}, {
|
|
|
|
|
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://hespokestyle.com/feed/"
|
|
|
|
}, {
|
|
|
|
|
|
|
|
"count": 100,
|
|
|
|
"feed_url": "http://effortlessgent.com/feed/"
|
|
|
|
}, {
|
|
|
|
|
|
|
|
"count": 100,
|
|
|
|
"feed_url": "https://feeds.feedburner.com/thisfits"
|
2015-07-20 15:56:35 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
var braider_options = {
|
2015-07-21 09:50:51 +00:00
|
|
|
feeds: feeds,
|
|
|
|
indent: " ",
|
|
|
|
date_sort_order: "desc", // Newest first
|
|
|
|
log_level: "warn",
|
2015-07-31 11:47:21 +00:00
|
|
|
dedupe_fields: ['link', 'guid'],
|
2015-08-14 09:55:39 +00:00
|
|
|
plugins_directories: [__dirname + "/plugins/"]
|
2015-07-20 15:56:35 +00:00
|
|
|
};
|
|
|
|
var rss_braider = RssBraider.createClient(braider_options);
|
|
|
|
|
|
|
|
// Override logging level (debug, info, warn, err, off)
|
2015-07-21 09:50:51 +00:00
|
|
|
rss_braider.logger.level('off');
|
2015-07-20 15:56:35 +00:00
|
|
|
|
2016-01-22 16:35:47 +00:00
|
|
|
rss_braider.processFeed('simple_test_feed', 'json', function (err, data) {
|
2015-07-20 15:56:35 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-21 09:50:51 +00:00
|
|
|
|
2015-07-31 11:47:21 +00:00
|
|
|
var j = JSON.parse(data);
|
|
|
|
var ejsOutput = ejs.compile(str)(j);
|
2015-07-31 10:49:19 +00:00
|
|
|
|
2016-01-22 16:35:47 +00:00
|
|
|
fs.writeFile(__dirname + "/html/" + outputFile + ".json", data, function (err) {
|
2015-07-27 12:52:34 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("The file was saved!");
|
|
|
|
});
|
|
|
|
|
2016-01-22 16:35:47 +00:00
|
|
|
fs.writeFile(__dirname + "/html/" + outputFile + ".html", ejsOutput, function (err) {
|
2015-07-21 09:50:51 +00:00
|
|
|
|
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
/*
|
2015-07-31 11:47:21 +00:00
|
|
|
rss_braider.processFeed('simple_test_feed', 'rss', function (err, data) {
|
2015-07-31 12:10:04 +00:00
|
|
|
|
2015-07-21 09:50:51 +00:00
|
|
|
fs.writeFile(__dirname + "/html/" + outputFile + ".xml", data, function (err) {
|
|
|
|
if (err) {
|
2015-07-20 15:56:35 +00:00
|
|
|
return console.log(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("The file was saved!");
|
|
|
|
});
|
2015-07-31 11:47:21 +00:00
|
|
|
});
|
2015-07-31 12:10:53 +00:00
|
|
|
*/
|