2018-02-13 12:43:37 +01:00
|
|
|
const utils = require('../utils');
|
|
|
|
|
|
2020-02-26 09:05:20 +01:00
|
|
|
let appliedBlackList = [];
|
|
|
|
|
|
2018-02-13 12:43:37 +01:00
|
|
|
function normalize(o) {
|
2019-10-24 21:25:19 +02:00
|
|
|
return o;
|
2018-02-13 12:43:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function applyBlacklist(o) {
|
2020-02-26 09:05:20 +01:00
|
|
|
return !utils.isOneOf(o.title, appliedBlackList);
|
2018-02-13 12:43:37 +01:00
|
|
|
}
|
|
|
|
|
|
2020-02-26 09:05:20 +01:00
|
|
|
const config = {
|
|
|
|
|
enabled: null,
|
|
|
|
|
url: null,
|
2020-06-22 09:29:32 +02:00
|
|
|
crawlContainer: '.nbk-container >div article',
|
2019-10-24 21:25:19 +02:00
|
|
|
crawlFields: {
|
|
|
|
|
id: '@id',
|
2020-02-16 13:09:15 +01:00
|
|
|
title: 'div.nbk-p-2 > h3 a@title | removeNewline | trim',
|
|
|
|
|
link: 'div.nbk-p-2 > h3 > a@href',
|
2020-06-22 09:29:32 +02:00
|
|
|
address: 'div.nbk-p-2 > p | removeNewline | trim',
|
2019-10-24 21:25:19 +02:00
|
|
|
},
|
|
|
|
|
paginate: '.numbered-pager__bottom .numbered-pager--info li:nth-child(2) a@href',
|
|
|
|
|
normalize: normalize,
|
2020-06-22 09:29:32 +02:00
|
|
|
filter: applyBlacklist,
|
2018-02-13 12:43:37 +01:00
|
|
|
};
|
|
|
|
|
|
2020-02-26 09:05:20 +01:00
|
|
|
exports.init = (sourceConfig, blacklist) => {
|
|
|
|
|
config.enabled = sourceConfig.enabled;
|
|
|
|
|
config.url = sourceConfig.url;
|
|
|
|
|
appliedBlackList = blacklist;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//must match the id of the source given in the config!
|
|
|
|
|
exports.id = () => 'neubauKompass';
|
|
|
|
|
|
|
|
|
|
exports.config = config;
|