ADD: new Neubaukompass provider | FIX: tests, console notifier

This commit is contained in:
Christian Kellner
2018-02-13 12:43:37 +01:00
parent 35bdc9e78c
commit 8a1d86c90e
14 changed files with 201 additions and 92 deletions

View File

@@ -4,10 +4,9 @@ const config = require('../../../conf/config.json');
* simply prints out the found data to the console
* @param serviceName e.g immoscout
* @param newListings an array with newly found listings
* @returns {Promise<Void> | void}
*/
exports.send = (serviceName, newListings) => {
return Promise.resolve(console.info(`Found entry from service ${serviceName}:`, newListings))
return [Promise.resolve(console.info(`Found entry from service ${serviceName}:`, newListings))];
};
/**

35
lib/provider/neubauKompass.js Executable file
View File

@@ -0,0 +1,35 @@
const config = require('../../conf/config.json');
const Fredy = require('../fredy');
const utils = require('../utils');
function normalize(o) {
const title = o.title + '| '+o.subTitle;
//this is a bit nasty, but we do not have a size, therefor take the availability and set it as size to not modify notifications any furter
const size = o.available;
return Object.assign(o, { title, size });
}
function applyBlacklist(o) {
return !utils.isOneOf(o.title, config.blacklist);
}
const neubauKompass = {
name: 'neubauKompass',
enabled: config.sources.neubauKompass.enabled,
url: config.sources.neubauKompass.url,
crawlContainer: '.md__property-list .post-list__item',
crawlFields: {
id: '@id',
price: '.entry__main .entry__data li:nth-child(1) span:nth-child(2) | removeNewline | trim',
available: '.entry__main .entry__data li:nth-child(3) span:nth-child(2) | removeNewline | trim',
title: '.entry__main .entry__title | removeNewline | trim',
link: '.entry__main .entry__title a@href',
subTitle: '.entry__main .entry__subtitle | removeNewline | trim',
address: '.entry__main .entry__info | removeNewline | trim'
},
paginate: '.numbered-pager__bottom .numbered-pager--info li:nth-child(2) a@href',
normalize: normalize,
filter: applyBlacklist
};
module.exports = new Fredy(neubauKompass);