mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
* init map view * switching off 3d buildings when sattelite view is on * rename menu items * upgrading dependencies, adding provider to popups * adding screenshot for map view * fixing readme * next release version
57 lines
1.8 KiB
JavaScript
Executable File
57 lines
1.8 KiB
JavaScript
Executable File
/*
|
|
* Copyright (c) 2026 by Christian Kellner.
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
*/
|
|
|
|
import { isOneOf, buildHash } from '../utils.js';
|
|
import checkIfListingIsActive from '../services/listings/listingActiveTester.js';
|
|
|
|
let appliedBlackList = [];
|
|
|
|
function normalize(o) {
|
|
const size = o.size || 'N/A m²';
|
|
const price = (o.price || '--- €').replace('Preis auf Anfrage', '--- €');
|
|
const title = o.title || 'No title available';
|
|
const immoId = o.id.substring(o.id.indexOf('-') + 1, o.id.length);
|
|
const link = `https://immo.swp.de/immobilien/${immoId}`;
|
|
const description = o.description;
|
|
const id = buildHash(immoId, price);
|
|
return Object.assign(o, { id, price, size, title, link, description });
|
|
}
|
|
|
|
function applyBlacklist(o) {
|
|
const titleNotBlacklisted = !isOneOf(o.title, appliedBlackList);
|
|
const descNotBlacklisted = !isOneOf(o.description, appliedBlackList);
|
|
return titleNotBlacklisted && descNotBlacklisted;
|
|
}
|
|
|
|
const config = {
|
|
url: null,
|
|
crawlContainer: '.js-serp-item',
|
|
sortByDateParam: 's=most_recently_updated_first',
|
|
waitForSelector: 'body',
|
|
crawlFields: {
|
|
id: '.js-bookmark-btn@data-id',
|
|
price: 'div.align-items-start div:first-child | trim',
|
|
size: 'div.align-items-start div:nth-child(3) | trim',
|
|
title: '.js-item-title-link@title | trim',
|
|
link: '.ci-search-result__link@href',
|
|
description: '.js-show-more-item-sm | removeNewline | trim',
|
|
image: 'img@src',
|
|
},
|
|
normalize: normalize,
|
|
filter: applyBlacklist,
|
|
activeTester: checkIfListingIsActive,
|
|
};
|
|
export const init = (sourceConfig, blacklist) => {
|
|
config.enabled = sourceConfig.enabled;
|
|
config.url = sourceConfig.url;
|
|
appliedBlackList = blacklist || [];
|
|
};
|
|
export const metaInformation = {
|
|
name: 'Immo Südwest Presse',
|
|
baseUrl: 'https://immo.swp.de/',
|
|
id: 'immoswp',
|
|
};
|
|
export { config };
|