Rinser/lifestyle.js

312 lines
6.2 KiB
JavaScript
Raw Normal View History

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 = {
2016-03-16 00:16:49 +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",
'site_url': 'http://pipes.silvrtree.co.uk/lifestyle.xml'
}, "plugins": ['filter_last_week', 'fix_images', 'fix_scripts'], "sources": [
{
"count": 100,
"feed_url": "http://feeds2.feedburner.com/acquire"
2015-07-20 15:56:35 +00:00
},
2017-04-11 22:06:56 +00:00
2016-03-16 00:16:49 +00:00
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.askmen.com/style.rss"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.askmen.com/fine_living.rss"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.askmen.com/money.rss"
}
/*,
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count" : 100,
"feed_url" : "http://abetterguy.com/feed/"
}*/,
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"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"
},
2015-07-20 21:25:42 +00:00
2017-04-11 22:06:56 +00:00
/*{
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.getkempt.com/rss.xml"
2017-04-11 22:06:56 +00:00
},*/
2016-03-16 00:16:49 +00:00
{
"count": 100,
"feed_url": "http://feeds.feedburner.com/kinowear"
},
{
"count": 100,
"feed_url": "http://www.mensfitness.co.uk/feeds/all"
},
{
"count": 100,
"feed_url": "http://feeds.feedburner.com/TheArtOfManliness"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.trunkclub.com/blog/feed"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://feeds.feedburner.com/acontinuouslean/"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.fashionbeans.com/feed/"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://feeds.feedburner.com/MensFlair?format=xml"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://feeds.feedburner.com/TheChoosyBeggar"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.valetmag.com/distribution/rss_all.xml"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://putthison.com/rss"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://dieworkwear.com/rss"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://menofhabit.tumblr.com/rss"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.hodinkee.com/blog/rss.xml"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://feeds.feedburner.com/firstinwatches"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://feeds2.feedburner.com/primermagazine/otzU"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://chrisguillebeau.com/3x5/feed/"
},
{
2015-07-20 21:25:42 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://feeds.feedburner.com/TheAwesomer"
},
{
2016-01-22 16:35:47 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://bondclothes.blogspot.com/feeds/posts/default"
},
{
2016-01-22 16:35:47 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://affordablebond007.tumblr.com/rss"
},
{
2016-01-22 16:35:47 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://thecozyspace.tumblr.com/rss"
},
{
2016-01-22 16:35:47 +00:00
2016-03-16 00:16:49 +00:00
"count": 100,
"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"
},
2017-04-11 22:06:56 +00:00
/*{
2016-03-16 00:16:49 +00:00
"count": 100,
"feed_url": "http://www.businessoffashion.com/syndication/feed"
2017-04-11 22:06:56 +00:00
},*/
2016-03-16 00:16:49 +00:00
{
"count": 100,
"feed_url": "http://dieworkwear.com/rss"
},
{
"count": 100,
"feed_url": "http://georgehahn.com/feed/"
},
{
"count": 100,
"feed_url": "http://www.mensjournal.com/services/rss/gear"
}
,
{
"count": 100,
"feed_url": "http://www.mensjournal.com/services/rss/food-drink"
}
,
{
"count": 100,
"feed_url": "http://www.mensjournal.com/services/rss/travel"
}
,
{
"count": 100,
"feed_url": "http://www.mensjournal.com/services/rss/adventure"
}
,
{
"count": 100,
"feed_url": "http://www.mensjournal.com/services/rss/health-fitness"
}
,
{
"count": 100,
"feed_url": "http://www.mensjournal.com/services/rss/style"
},
{
"count": 100,
"feed_url": "https://feeds.feedburner.com/uncrate"
},
{
"count": 100,
"feed_url": "https://feeds.feedburner.com/ManOfMany"
2017-04-11 22:06:56 +00:00
},
{
"count": 100,
"feed_url": "http://feeds.feedburner.com/nymag/vulture"
}
2016-11-01 07:41:25 +00:00
/*,
2016-03-16 00:16:49 +00:00
{
"count": 100,
"feed_url": "http://www.mantelligence.com/feed/"
}
2016-11-01 07:41:25 +00:00
*/
2016-03-16 00:16:49 +00:00
]
2015-07-20 15:56:35 +00:00
};
var braider_options = {
2016-03-16 00:16:49 +00:00
feeds: feeds,
indent: " ",
date_sort_order: "desc", // Newest first
log_level: "warn",
dedupe_fields: ['link', 'guid'],
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
2016-03-16 00:16:49 +00:00
rss_braider.processFeed('simple_test_feed', 'json', function(err, data) {
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
2016-03-16 00:16:49 +00:00
fs.writeFile(__dirname + "/dist/" + outputFile + ".json",
data,
function(err) {
if (err) {
return console.log(err);
}
2015-07-27 12:52:34 +00:00
2016-03-16 00:16:49 +00:00
console.log("The file was saved!");
2015-07-27 12:52:34 +00:00
});
2016-03-16 00:16:49 +00:00
fs.writeFile(__dirname + "/dist/" + outputFile + ".html",
ejsOutput,
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
2016-03-16 00:16:49 +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!");
});
});
*/