mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fixing kalaydo provider
This commit is contained in:
@@ -8,8 +8,8 @@ function normalize(o) {
|
||||
.split('/')
|
||||
.filter(Boolean)
|
||||
.reverse()[0];
|
||||
const price = o.price.replace('Preis: ', '');
|
||||
let size = o.size.replace('Wohnfläche: ', '').replace('ca. ', '');
|
||||
const price = o.price == null ? 'unknown' : o.price.trim().replace('Preis', '');
|
||||
let size = o.size == null ? 'unknown' : o.size.replace('Wohnfläche: ', '').replace('ca. ', '');
|
||||
size += ' / ' + o.rooms;
|
||||
const address = '---';
|
||||
|
||||
@@ -21,7 +21,7 @@ function applyBlacklist(o) {
|
||||
const descNotBlacklisted = !utils.isOneOf(o.description, appliedBlackList);
|
||||
|
||||
const isBlacklistedDistrict =
|
||||
appliedBlacklistedDistricts.length === 0 ? false : utils.isOneOf(o.title, appliedBlacklistedDistricts);
|
||||
appliedBlacklistedDistricts.length === 0 ? false : utils.isOneOf(o.title, appliedBlacklistedDistricts);
|
||||
|
||||
return !isBlacklistedDistrict && titleNotBlacklisted && descNotBlacklisted;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ const config = {
|
||||
crawlContainer: '#resultList .resultitem-content-container',
|
||||
crawlFields: {
|
||||
id: '.resultitem-content-container a@href',
|
||||
price: '.clear-row .rent | removeNewline | trim',
|
||||
price: '.description .rent | removeNewline | trim',
|
||||
title: '.resultitem-content-container a@title',
|
||||
link: '.resultitem-content-container a@href',
|
||||
rooms: '.resultitem-content-container .no-of-rooms | removeNewline | trim',
|
||||
@@ -44,14 +44,13 @@ const config = {
|
||||
};
|
||||
|
||||
exports.init = (sourceConfig, blacklist, blacklistedDistricts) => {
|
||||
config.enabled = sourceConfig.enabled;
|
||||
config.url = sourceConfig.url;
|
||||
appliedBlackList = blacklist;
|
||||
appliedBlacklistedDistricts = blacklistedDistricts;
|
||||
config.enabled = sourceConfig.enabled;
|
||||
config.url = sourceConfig.url;
|
||||
appliedBlackList = blacklist;
|
||||
appliedBlacklistedDistricts = blacklistedDistricts;
|
||||
};
|
||||
|
||||
//must match the id of the source given in the config!
|
||||
exports.id = () => 'kalaydo';
|
||||
|
||||
exports.config = config;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('#kalaydo testsuite()', () => {
|
||||
'./notification/notify': mockNotification
|
||||
});
|
||||
|
||||
it('should test kalaydo provider', async () => {
|
||||
it.only('should test kalaydo provider', async () => {
|
||||
return await new Promise(resolve => {
|
||||
const fredy = new Fredy(provider.config, null, provider.id(), 'test1');
|
||||
fredy.execute().then(() => {
|
||||
|
||||
Reference in New Issue
Block a user