2023-03-13 13:42:43 +01:00
|
|
|
import utils from '../utils.js';
|
2020-02-26 09:05:20 +01:00
|
|
|
let appliedBlackList = [];
|
2018-01-20 20:23:27 +01:00
|
|
|
function normalize(o) {
|
2021-10-06 10:45:13 +02:00
|
|
|
return o;
|
2018-01-20 20:23:27 +01:00
|
|
|
}
|
|
|
|
|
function applyBlacklist(o) {
|
2020-02-26 09:05:20 +01:00
|
|
|
const titleNotBlacklisted = !utils.isOneOf(o.title, appliedBlackList);
|
|
|
|
|
const descNotBlacklisted = !utils.isOneOf(o.description, appliedBlackList);
|
2018-01-20 20:23:27 +01:00
|
|
|
return titleNotBlacklisted && descNotBlacklisted;
|
|
|
|
|
}
|
2020-02-26 09:05:20 +01:00
|
|
|
const config = {
|
|
|
|
|
url: null,
|
2021-10-06 10:45:13 +02:00
|
|
|
crawlContainer: "div[class^='EstateItem-']",
|
2021-11-26 21:02:09 +01:00
|
|
|
sortByDateParam: 'sd=DESC&sf=TIMESTAMP',
|
2018-01-20 20:23:27 +01:00
|
|
|
crawlFields: {
|
2021-10-06 10:45:13 +02:00
|
|
|
id: 'a@id',
|
|
|
|
|
price: "div[class^='KeyFacts-'] [data-test='price'] | removeNewline | trim",
|
|
|
|
|
size: "div[class^='KeyFacts-'] [data-test='area'] | removeNewline | trim",
|
|
|
|
|
title: "div[class^='FactsMain-'] h2",
|
2018-01-20 20:23:27 +01:00
|
|
|
link: 'a@href',
|
2021-10-06 10:45:13 +02:00
|
|
|
address: "div[class^='estateFacts-'] span | removeNewline | trim",
|
2018-01-20 20:23:27 +01:00
|
|
|
},
|
|
|
|
|
paginate: '#pnlPaging #nlbPlus@href',
|
|
|
|
|
normalize: normalize,
|
2021-01-21 16:09:23 +01:00
|
|
|
filter: applyBlacklist,
|
2018-01-20 20:23:27 +01:00
|
|
|
};
|
2023-03-13 13:42:43 +01:00
|
|
|
export const init = (sourceConfig, blacklist) => {
|
2020-02-26 09:05:20 +01:00
|
|
|
config.enabled = sourceConfig.enabled;
|
|
|
|
|
config.url = sourceConfig.url;
|
2021-01-21 16:09:23 +01:00
|
|
|
appliedBlackList = blacklist || [];
|
|
|
|
|
};
|
2023-03-13 13:42:43 +01:00
|
|
|
export const metaInformation = {
|
2021-01-21 16:09:23 +01:00
|
|
|
name: 'Immowelt',
|
|
|
|
|
baseUrl: 'https://www.immowelt.de/',
|
2023-03-13 13:42:43 +01:00
|
|
|
id: 'immowelt',
|
2020-02-26 09:05:20 +01:00
|
|
|
};
|
2023-03-13 13:42:43 +01:00
|
|
|
export { config };
|