Rinser/lifestyle.js
martind2000@gmail.com eb2ac9eddc lifestyle updated
2015-07-20 22:25:42 +01:00

213 lines
5.7 KiB
JavaScript

var RssBraider = require('rss-braider'), fs = require('fs'),
feeds = {};
// Pull feeds from config files: ,
// feeds.simple_test_feed = require("./config/feed").feed;
// Or define in-line
feeds.simple_test_feed = {
"feed_name" : "feed",
"default_count" : 1,
"no_cdata_fields" : [], // Don't wrap these fields in CDATA tags
"meta" : {
"title": "Lifestyle",
"description": "Combined Lifestyle Feed",
'site_url': 'http://pipes.silvrtree.co.uk/lifestyle.xml'
},
"sources" : [
{
"count" : 100,
"feed_url" : "http://feeds2.feedburner.com/acquire"
},
{
"count" : 100,
"feed_url" : "http://www.fhm.com/category/style/feed"
},
{
"count" : 100,
"feed_url" : "http://www.askmen.com/style.rss"
},
{
"count" : 100,
"feed_url" : "http://www.askmen.com/fine_living.rss"
},
{
"count" : 100,
"feed_url" : "http://www.askmen.com/money.rss"
},
{
"count" : 100,
"feed_url" : "http://abetterguy.com/feed/"
},
{
"count" : 100,
"feed_url" : "http://www.dmarge.com/feed"
},
{
"count" : 100,
"feed_url" : "http://www.esquire.com/rss/all.xml"
},
{
"count" : 100,
"feed_url" : "http://feeds.feedburner.com/gearpatrol"
},
{
"count" : 100,
"feed_url" : "http://www.getkempt.com/rss.xml"
},
{
"count" : 100,
"feed_url" : "https://feeds.feedburner.com/kinowear"
},
{
"count" : 100,
"feed_url" : "http://www.mensfitness.co.uk/feeds/all"
},
{
"count" : 100,
"feed_url" : "https://feeds.feedburner.com/TheArtOfManliness"
},
{
"count" : 100,
"feed_url" : "https://www.trunkclub.com/blog/feed"
},
{
"count" : 100,
"feed_url" : "https://feeds.feedburner.com/acontinuouslean/"
},
{
"count" : 100,
"feed_url" : "http://www.fashionbeans.com/feed/"
},
{
"count" : 100,
"feed_url" : "https://feeds.feedburner.com/MensFlair?format=xml"
},
{
"count" : 100,
"feed_url" : "https://feeds.feedburner.com/TheChoosyBeggar"
},
{
"count" : 100,
"feed_url" : "http://www.valetmag.com/distribution/rss_all.xml"
},
{
"count" : 100,
"feed_url" : "http://putthison.com/rss"
},
{
"count" : 100,
"feed_url" : "http://dieworkwear.com/rss"
},
{
"count" : 100,
"feed_url" : "http://menofhabit.tumblr.com/rss"
},
{
"count" : 100,
"feed_url" : "http://www.hodinkee.com/blog/rss.xml"
},
{
"count" : 100,
"feed_url" : "http://www.hodinkee.com/blog/rss.xml"
},
{
"count" : 100,
"feed_url" : "http://www.gq-magazine.co.uk/RSS"
},
{
"count" : 100,
"feed_url" : "http://feeds.feedburner.com/firstinwatches"
},
{
"count" : 100,
"feed_url" : "http://feeds2.feedburner.com/primermagazine/otzU"
},
{
"count" : 100,
"feed_url" : "http://chrisguillebeau.com/3x5/feed/"
},
{
"count" : 100,
"feed_url" : "http://feeds.feedburner.com/TheAwesomer"
},
{
"count" : 100,
"feed_url" : "http://bondclothes.blogspot.com/feeds/posts/default"
},
{
"count" : 100,
"feed_url" : "http://affordablebond007.tumblr.com/rss"
},
{
"count" : 100,
"feed_url" : "http://thecozyspace.tumblr.com/rss"
},
{
"count" : 100,
"feed_url" : "http://fourpins.com/feed/"
}
]
};
var braider_options = {
feeds : feeds,
indent : " ",
date_sort_order : "desc", // Newest first
log_level : "warn"
};
var rss_braider = RssBraider.createClient(braider_options);
// Override logging level (debug, info, warn, err, off)
rss_braider.logger.level('warn');
// Output braided feed as rss. use 'json' for JSON output.
rss_braider.processFeed('simple_test_feed', 'rss', function(err, data){
// rss_braider.processFeed('simple_test_feed', 'json', function(err, data){
if (err) {
return console.log(err);
}
// console.log(data);
fs.writeFile(__dirname + "/html/lifestyle.xml", data, function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
});