2015-07-21 12:05:49 +00:00
|
|
|
var outputFile = 'jobs-local',
|
2017-09-11 10:34:45 +00:00
|
|
|
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 13:42:07 +00:00
|
|
|
|
2016-04-27 15:32:36 +00:00
|
|
|
// Pull feeds from config files:
|
|
|
|
// feeds.simple_test_feed = require("./config/feed").feed;
|
|
|
|
// Or define in-line
|
2015-07-20 13:42:07 +00:00
|
|
|
feeds.simple_test_feed = {
|
2017-09-11 10:34:45 +00:00
|
|
|
'feed_name': 'feed',
|
|
|
|
'default_count': 1,
|
|
|
|
'no_cdata_fields': [], // Don't wrap these fields in CDATA tags
|
|
|
|
'plugins': ['filter_today_only'],
|
|
|
|
'meta': {
|
|
|
|
'title': 'Jobs',
|
|
|
|
'description': 'Combined Jobs Feed',
|
|
|
|
'site_url': 'http://pipes.silvrtree.co.uk/jobs-local.xml'
|
|
|
|
},
|
|
|
|
'sources': [{
|
2017-09-11 13:55:11 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobserve.com%2FMySearch%2FBAEBF3BDF82B8FEF.rss'
|
2017-09-11 13:55:11 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D47820652'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobserve.com%2FMySearch%2F6DA9769BA89834AA.rss'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.JobServe.com%2FMySearch%2FEDF47BEA6B31EF.rss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.JobServe.com%2FMySearch%2F3CAD044BEF2BFA.rss'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.JobServe.com%2FMySearch%2FC7B25D86D0844A.rss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.JobServe.com%2FMySearch%2F64A3EEF615FA4C.rss'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D21564698'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D21564712'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D21942123'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D33166238'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D34888173'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Fm7dp711z2r.xml'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Fpfvf7o7z2r.xml'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Flluqnt8z2r.xml'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Ftu33qt8z2r.xml'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Fu3btnz8z2r.xml'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.purelyit.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D33256062'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.purelyit.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D33450169'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.purelyit.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D34517029'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.purelyit.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26daysback%3D1%26jbe_id%3D34888105'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.technojobs.co.uk%2Frss.php%2Fglasgow%2Fsearchtypeand%2FlocationScotland%2Fsortbyrelevant%2Fjobtypeall'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobserve.com%2FMySearch%2F6FC7E9ED5F042ECB.rss'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26skill_atleast%3Dhtml%2520%2C%2520asp%2520%2C%2520web%2520%2C%2520sql%2520%2C%2520delphi%2520%2C%2520vb%2520%2C%2520vbscript%2520%2C%2520php%2520%2C%2520ajax%2520%2C%2520mysql%2520%2C%2520sqlserver%2520%2C%2520javascript%2520%2C%2520intranet%2520%2C%2520vmware%2520%2C%2520virtulization%26location_include%3DLondon%26location_within%3D10%26reqd_salary%3DANY%7C%26daysback%3D7%26scc%3DUK%26compare_resolved%3DCO_LONDON%26compare_search%3DLondon%26search_emp_mkt_cd%3DALL'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26skill_atleast%3Dhtml%2520%2C%2520asp%2520%2C%2520web%2520%2C%2520sql%2520%2C%2520delphi%2520%2C%2520vb%2520%2C%2520vbscript%2520%2C%2520php%2520%2C%2520ajax%2520%2C%2520mysql%2520%2C%2520sqlserver%2520%2C%2520javascript%2520%2C%2520intranet%2520%2C%2520vmware%2520%2C%2520virtulization%26location_include%3DGlasgow%26location_within%3D10%26reqd_salary%3DANY%7C%26daysback%3D7%26scc%3DUK%26compare_resolved%3DTO_G1_GLASGOW%26compare_search%3DGlasgow%26search_emp_mkt_cd%3DALL'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26skill_atleast%3Dhtml%2520%2C%2520asp%2520%2C%2520web%2520%2C%2520sql%2520%2C%2520delphi%2520%2C%2520vb%2520%2C%2520vbscript%2520%2C%2520php%2520%2C%2520ajax%2520%2C%2520mysql%2520%2C%2520sqlserver%2520%2C%2520javascript%2520%2C%2520intranet%2520%2C%2520vmware%2520%2C%2520virtulization%26location_within%3D10%26reqd_salary%3DANY%7C%26daysback%3D7%26scc%3DUK%26search_emp_mkt_cd%3DALL'
|
2017-09-11 10:34:45 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26skill_atleast%3Dhtml%2520%2C%2520asp%2520%2C%2520web%2520%2C%2520sql%2520%2C%2520delphi%2520%2C%2520vb%2520%2C%2520vbscript%2520%2C%2520php%2520%2C%2520ajax%2520%2C%2520mysql%2520%2C%2520sqlserver%2520%2C%2520javascript%2520%2C%2520intranet%2520%2C%2520vmware%2520%2C%2520virtulization%26location_include%3DGermany%26location_within%3D10%26reqd_salary%3DANY%7C%26daysback%3D7%26scc%3DUK%26compare_resolved%3DCY_GERMANY%26compare_search%3DGermany%26search_emp_mkt_cd%3DALL'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Fb1d7e6c3a9a11964z3r.xml'}, {
|
2017-09-11 10:34:45 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobserve.com%2FMySearch%2FCA49421A86CA3F74.rss'
|
|
|
|
}, {'count': 100, 'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2Fddeded091b6f6d33z3r.xml'}, {
|
2017-09-11 13:55:11 +00:00
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.s1jobs.com%2Fxml%2F3eafc1ea20f1ca02z3r.xml'
|
2017-09-11 13:55:11 +00:00
|
|
|
}, {
|
|
|
|
'count': 100,
|
2018-03-04 16:39:52 +00:00
|
|
|
'feed_url': 'http://45.33.114.116:8080/http%3A%2F%2Fwww.jobsite.co.uk%2Fcgi-bin%2Fadvsearch%3Frss_feed%3D1%26skill_atleast%3Dhtml%2C%2520asp%2C%2520web%2C%2520sql%2C%2520delphi%2C%2520vb%2C%2520vbscript%2C%2520php%2C%2520ajax%2C%2520mysql%2C%2520sqlserver%2C%2520javascript%2C%2520intranet%2C%2520vmware%2C%2520virtulization%26location_include%3DAbu%2520Dhabi%26compare_resolved%3DRE_ABUDHABI_UNITEDARABEMIRATES%26compare_search%3DAbu%2520Dhabi%26jobtype%3DX%26search_emp_mkt_cd%3DALL'
|
2017-09-11 13:55:11 +00:00
|
|
|
}]
|
2015-07-20 13:42:07 +00:00
|
|
|
};
|
2015-07-21 12:05:49 +00:00
|
|
|
|
2015-07-20 13:42:07 +00:00
|
|
|
var braider_options = {
|
2017-09-11 10:34:45 +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 13:42:07 +00:00
|
|
|
};
|
|
|
|
var rss_braider = RssBraider.createClient(braider_options);
|
|
|
|
|
2016-04-27 15:32:36 +00:00
|
|
|
// Override logging level (debug, info, warn, err, off)
|
2016-07-05 09:36:17 +00:00
|
|
|
rss_braider.logger.level('error');
|
2015-07-20 13:42:07 +00:00
|
|
|
|
2015-07-21 12:05:49 +00:00
|
|
|
rss_braider.processFeed('simple_test_feed', 'json', function (err, data) {
|
2017-09-11 10:34:45 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-21 12:05:49 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
var j = JSON.parse(data);
|
|
|
|
var ejsOutput = ejs.compile(str)(j);
|
2015-07-21 12:05:49 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
fs.writeFile(__dirname + '/dist/' + outputFile + '.html', ejsOutput, function (err) {
|
2015-07-21 12:05:49 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2015-07-21 12:05:49 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
console.log('The file was saved!');
|
|
|
|
});
|
2016-04-27 15:32:36 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
fs.writeFile(__dirname + '/dist/' + outputFile + '.json', data, function (err) {
|
|
|
|
if (err) {
|
|
|
|
logger.error(err);
|
|
|
|
return console.log(err);
|
|
|
|
}
|
2016-04-27 15:32:36 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
console.log('The file was saved!');
|
|
|
|
});
|
2015-07-21 12:05:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
rss_braider.processFeed('simple_test_feed', 'rss', function (err, data) {
|
2017-09-11 10:34:45 +00:00
|
|
|
if (err) {
|
|
|
|
return console.log(err);
|
|
|
|
}
|
|
|
|
fs.writeFile(__dirname + '/dist/' + outputFile + '.xml', data, function (err) {
|
2015-07-20 13:42:07 +00:00
|
|
|
if (err) {
|
2017-09-11 10:34:45 +00:00
|
|
|
return console.log(err);
|
2015-07-20 13:42:07 +00:00
|
|
|
}
|
2015-07-20 14:26:53 +00:00
|
|
|
|
2017-09-11 10:34:45 +00:00
|
|
|
console.log('The file was saved!');
|
|
|
|
});
|
2015-07-20 14:26:53 +00:00
|
|
|
});
|