mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
bugfixes and improvements
This commit is contained in:
@@ -20,7 +20,7 @@ function normalize(o) {
|
||||
const link = `${baseUrl}/expose/${o.id}.html`;
|
||||
const price = normalizePrice(o.price);
|
||||
const id = buildHash(o.id, price);
|
||||
const image = baseUrl + o.image;
|
||||
const image = o.image == null ? null : baseUrl + o.image;
|
||||
const address = o.address == null ? null : o.address.trim().replaceAll('/', ',');
|
||||
return {
|
||||
id,
|
||||
|
||||
@@ -19,7 +19,7 @@ function normalize(o) {
|
||||
const originalId = o.id.split('/').pop();
|
||||
const id = buildHash(originalId, o.price);
|
||||
const link = o.link != null ? `https://www.mcmakler.de${o.link}` : o.link;
|
||||
const [rooms, size] = o.tags.split(' | ');
|
||||
const [rooms, size] = (o.tags || '').split(' | ');
|
||||
const address = o.address?.replace(' / ', ' ') || null;
|
||||
return {
|
||||
id,
|
||||
|
||||
@@ -21,7 +21,8 @@ function normalize(o) {
|
||||
const link = o.link != null ? decodeURIComponent(o.link) : config.url;
|
||||
|
||||
const urlReg = new RegExp(/url\((.*?)\)/gim);
|
||||
const image = o.image != null ? urlReg.exec(o.image)[1] : null;
|
||||
const imageMatch = o.image != null ? urlReg.exec(o.image) : null;
|
||||
const image = imageMatch != null ? imageMatch[1] : null;
|
||||
return {
|
||||
id,
|
||||
link,
|
||||
|
||||
@@ -44,6 +44,7 @@ function normalize(o) {
|
||||
const link = `https://www.wg-gesucht.de${o.link}`;
|
||||
const image = o.image != null ? o.image.replace('small', 'large') : null;
|
||||
const [rooms, city, road] = o.details?.split(' | ') || [];
|
||||
const address = [city, road].filter(Boolean).join(', ') || null;
|
||||
return {
|
||||
id,
|
||||
link,
|
||||
@@ -51,7 +52,7 @@ function normalize(o) {
|
||||
price: extractNumber(o.price),
|
||||
size: extractNumber(o.size),
|
||||
rooms: extractNumber(rooms),
|
||||
address: `${city}, ${road}`,
|
||||
address,
|
||||
image,
|
||||
description: o.description,
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ function normalize(o) {
|
||||
const [city = '', part = ''] = (o.description || '').split('-').map((v) => v.trim());
|
||||
const address = `${part}, ${city}`;
|
||||
return {
|
||||
id: o.link.split('/').pop(),
|
||||
id: o.link != null ? o.link.split('/').pop() : null,
|
||||
link: o.link,
|
||||
title: o.title || '',
|
||||
price: extractNumber(o.price),
|
||||
@@ -38,7 +38,7 @@ function normalize(o) {
|
||||
function applyBlacklist(o) {
|
||||
const titleNotBlacklisted = !utils.isOneOf(o.title, appliedBlackList);
|
||||
const descNotBlacklisted = !utils.isOneOf(o.description, appliedBlackList);
|
||||
return o.id != null && o.title != null && titleNotBlacklisted && descNotBlacklisted && o.link.startsWith(o.link);
|
||||
return o.id != null && o.title != null && o.link != null && titleNotBlacklisted && descNotBlacklisted;
|
||||
}
|
||||
|
||||
/** @type {ProviderConfig} */
|
||||
|
||||
Reference in New Issue
Block a user