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
53 lines
1.6 KiB
JavaScript
Executable File
53 lines
1.6 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 id = buildHash(o.id, o.price);
|
|
const link = `https://www.wg-gesucht.de${o.link}`;
|
|
const image = o.image != null ? o.image.replace('small', 'large') : null;
|
|
return Object.assign(o, { id, link, image });
|
|
}
|
|
|
|
function applyBlacklist(o) {
|
|
const titleNotBlacklisted = !isOneOf(o.title, appliedBlackList);
|
|
const descNotBlacklisted = !isOneOf(o.description, appliedBlackList);
|
|
return o.id != null && titleNotBlacklisted && descNotBlacklisted;
|
|
}
|
|
|
|
const config = {
|
|
url: null,
|
|
crawlContainer: '#main_column .wgg_card',
|
|
sortByDateParam: 'sort_column=0&sort_order=0',
|
|
waitForSelector: 'body',
|
|
crawlFields: {
|
|
id: '@data-id',
|
|
details: '.row .noprint .col-xs-11 |removeNewline |trim',
|
|
price: '.middle .col-xs-3 |removeNewline |trim',
|
|
size: '.middle .text-right |removeNewline |trim',
|
|
title: '.truncate_title a |removeNewline |trim',
|
|
link: '.truncate_title a@href',
|
|
image: '.img-responsive@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: 'Wg gesucht',
|
|
baseUrl: 'https://www.wg-gesucht.de/',
|
|
id: 'wgGesucht',
|
|
};
|
|
export { config };
|