mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
ADD: new Neubaukompass provider | FIX: tests, console notifier
This commit is contained in:
@@ -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
35
lib/provider/neubauKompass.js
Executable 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);
|
||||
Reference in New Issue
Block a user