jobscraper/scrapers/rss.s1jobs.js
2020-05-22 23:40:33 +01:00

64 lines
1.2 KiB
JavaScript

/**
* Created by WebStorm.
* User: martin
* Date: 22/05/2020
* Time: 17:20
*/
const MasterRSS = require('../lib/rss');
class RssS1Jobs extends MasterRSS {
constructor() {
super({
'customFields':{
'item': [
['summary', 'content'],
['issued', 'pubDate']
]
}
});
this.siteurl = 'www.s1jobs.com';
this.siteid = 's1jobs';
this.useStone = true;
this.requestOptions = {
'url' : ''
};
this.guidRegex = /\/en\/(.*?)\./;
this.imgRegex = /src="(.+?)"/g;
this.locationRegEx = /Location:(.*?) /;
this.companyRegEx = /Advertiser:(?: )?(.*?)(?:Reference|Start|Email)/;
this.rateRegEx = /Rate:(?: )?(.*?)(?: |Reference|Start|Email|Type)/;
}
reduceItem(item) {
const newObj = this.newRecord();
/*console.log('++ reduce');
console.log(item);
*/
newObj.title = item.title;
newObj.postDate = item.isoDate;
newObj.url = item.link;
newObj.summary = item.content;
newObj.id = item.id;
/*
console.log(newObj);
console.log('-- reduce');
*/
return newObj;
}
async go(url) {
super.go();
this.setStartUrl(url);
await this.processFeed();
}
}
module.exports = RssS1Jobs;