jobs fix, reverted
This commit is contained in:
parent
9613fa0631
commit
25118e19ee
72
jobs-new.js
Normal file
72
jobs-new.js
Normal file
@ -0,0 +1,72 @@
|
||||
const outputFile = 'jobs-new', 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 = {};
|
||||
|
||||
const argv = require('yargs').argv;
|
||||
|
||||
const log4js = require('log4js');
|
||||
const logger = log4js.getLogger();
|
||||
|
||||
// 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": ['description'], // Don't wrap these fields in CDATA tags
|
||||
"meta": {
|
||||
"title": "News",
|
||||
"description": "Combined News Feed",
|
||||
'site_url': 'http://pipes.silvrtree.co.uk/jobs-new.xml'
|
||||
},
|
||||
"plugins": [
|
||||
|
||||
],
|
||||
'custom_namespaces' : {
|
||||
"content" : "http://purl.org/rss/1.0/modules/content/",
|
||||
"slash" : "http://purl.org/rss/1.0/modules/slash/",
|
||||
"media" : "http://search.yahoo.com/mrss/",
|
||||
"ev" : "http://purl.org/rss/2.0/modules/event/",
|
||||
"sy" : "http://purl.org/rss/1.0/modules/syndication/",
|
||||
"wfw" : "http://wellformedweb.org/CommentAPI/",
|
||||
"dc" : "http://purl.org/dc/elements/1.1/",
|
||||
"atom" : "http://www.w3.org/2005/Atom"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
|
||||
"count": 100,
|
||||
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=47820652"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
;
|
||||
let braider_options = {
|
||||
feeds: feeds,
|
||||
indent: " ",
|
||||
date_sort_order: "desc", // Newest first
|
||||
log_level: "debug",
|
||||
dedupe_fields: ['link', 'guid'],
|
||||
plugins_directories: [__dirname + "/plugins/"]
|
||||
};
|
||||
const rss_braider = RssBraider.createClient(braider_options);
|
||||
|
||||
// Override logging level (debug, info, warn, err, off)
|
||||
//rss_braider.logger.level('off');
|
||||
|
||||
rss_braider.processFeed('simple_test_feed', 'rss', function(err, data) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
console.log('Saving', __dirname + "/dist/" + outputFile + ".xml");
|
||||
fs.writeFile(__dirname + "/dist/" + outputFile + ".xml", data, function(err) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
|
||||
console.log("The file was saved!");
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user