mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
* Fredy now supports pulling the main Image from the listing and send it together with the usual information
45 lines
1.6 KiB
JavaScript
Executable File
45 lines
1.6 KiB
JavaScript
Executable File
import utils, { buildHash } from '../utils.js';
|
|
|
|
let appliedBlackList = [];
|
|
|
|
function normalize(o) {
|
|
const id = buildHash(o.id, o.price);
|
|
return Object.assign(o, { id });
|
|
}
|
|
|
|
function applyBlacklist(o) {
|
|
const titleNotBlacklisted = !utils.isOneOf(o.title, appliedBlackList);
|
|
const descNotBlacklisted = !utils.isOneOf(o.description, appliedBlackList);
|
|
return titleNotBlacklisted && descNotBlacklisted;
|
|
}
|
|
|
|
const config = {
|
|
url: null,
|
|
crawlContainer:
|
|
'div[data-testid="serp-core-scrollablelistview-testid"]:not(div[data-testid="serp-enlargementlist-testid"] div[data-testid="serp-card-testid"]) div[data-testid="serp-core-classified-card-testid"]',
|
|
sortByDateParam: 'order=DateDesc',
|
|
waitForSelector: 'div[data-testid="serp-gridcontainer-testid"]',
|
|
crawlFields: {
|
|
id: 'a@href',
|
|
price: 'div[data-testid="cardmfe-price-testid"] | removeNewline | trim',
|
|
size: 'div[data-testid="cardmfe-keyfacts-testid"] | removeNewline | trim',
|
|
title: 'div[data-testid="cardmfe-description-box-text-test-id"] > div:nth-of-type(2)',
|
|
link: 'a@href',
|
|
address: 'div[data-testid="cardmfe-description-box-address"] | removeNewline | trim',
|
|
image: 'div[data-testid="cardMfe-card-pictureBox-opacity"] img@src',
|
|
},
|
|
normalize: normalize,
|
|
filter: applyBlacklist,
|
|
};
|
|
export const init = (sourceConfig, blacklist) => {
|
|
config.enabled = sourceConfig.enabled;
|
|
config.url = sourceConfig.url;
|
|
appliedBlackList = blacklist || [];
|
|
};
|
|
export const metaInformation = {
|
|
name: 'Immowelt',
|
|
baseUrl: 'https://www.immowelt.de/',
|
|
id: 'immowelt',
|
|
};
|
|
export { config };
|