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
59 lines
2.1 KiB
JavaScript
Executable File
59 lines
2.1 KiB
JavaScript
Executable File
/*
|
|
* Copyright (c) 2026 by Christian Kellner.
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
*/
|
|
|
|
import { buildHash, isOneOf } from '../utils.js';
|
|
import checkIfListingIsActive from '../services/listings/listingActiveTester.js';
|
|
|
|
let appliedBlackList = [];
|
|
let appliedBlacklistedDistricts = [];
|
|
|
|
function normalize(o) {
|
|
const size = o.size || '--- m²';
|
|
const id = buildHash(o.id, o.price);
|
|
const link = `https://www.kleinanzeigen.de${o.link}`;
|
|
return Object.assign(o, { id, size, link });
|
|
}
|
|
|
|
function applyBlacklist(o) {
|
|
const titleNotBlacklisted = !isOneOf(o.title, appliedBlackList);
|
|
const descNotBlacklisted = !isOneOf(o.description, appliedBlackList);
|
|
const isBlacklistedDistrict =
|
|
appliedBlacklistedDistricts.length === 0 ? false : isOneOf(o.description, appliedBlacklistedDistricts);
|
|
return o.title != null && !isBlacklistedDistrict && titleNotBlacklisted && descNotBlacklisted;
|
|
}
|
|
|
|
const config = {
|
|
url: null,
|
|
crawlContainer: '#srchrslt-adtable .ad-listitem ',
|
|
//sort by date is standard oO
|
|
sortByDateParam: null,
|
|
waitForSelector: 'body',
|
|
crawlFields: {
|
|
id: '.aditem@data-adid | int',
|
|
price: '.aditem-main--middle--price-shipping--price | removeNewline | trim',
|
|
size: '.aditem-main .text-module-end | removeNewline | trim',
|
|
title: '.aditem-main .text-module-begin a | removeNewline | trim',
|
|
link: '.aditem-main .text-module-begin a@href | removeNewline | trim',
|
|
description: '.aditem-main .aditem-main--middle--description | removeNewline | trim',
|
|
address: '.aditem-main--top--left | trim | removeNewline',
|
|
image: 'img@src',
|
|
},
|
|
normalize: normalize,
|
|
filter: applyBlacklist,
|
|
activeTester: checkIfListingIsActive,
|
|
};
|
|
export const metaInformation = {
|
|
name: 'Ebay Kleinanzeigen',
|
|
baseUrl: 'https://www.kleinanzeigen.de/',
|
|
id: 'kleinanzeigen',
|
|
};
|
|
export const init = (sourceConfig, blacklist, blacklistedDistricts) => {
|
|
config.enabled = sourceConfig.enabled;
|
|
config.url = sourceConfig.url;
|
|
appliedBlacklistedDistricts = blacklistedDistricts || [];
|
|
appliedBlackList = blacklist || [];
|
|
};
|
|
export { config };
|