mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
ADD: new provider for '1AImmobilien' / CHANGE: removing rootPath dependency, readme adjustments
This commit is contained in:
37
lib/provider/einsAImmobilien.js
Executable file
37
lib/provider/einsAImmobilien.js
Executable file
@@ -0,0 +1,37 @@
|
||||
const config = require('../../conf/config.json');
|
||||
const Fredy = require('../fredy');
|
||||
const utils = require('../utils');
|
||||
|
||||
function normalize(o) {
|
||||
const size = `${o.size.replace(' Wohnfläche ', '').trim()} / ${o.rooms.trim()}`;
|
||||
const link = `https://www.1a-immobilienmarkt.de/expose/13691814${o.id}.html`
|
||||
|
||||
return Object.assign(o, { size, link });
|
||||
}
|
||||
|
||||
function applyBlacklist(o) {
|
||||
const titleNotBlacklisted = !utils.isOneOf(o.title, config.blacklist);
|
||||
const descNotBlacklisted = !utils.isOneOf(o.description, config.blacklist);
|
||||
|
||||
return titleNotBlacklisted && descNotBlacklisted;
|
||||
}
|
||||
|
||||
const einsAImmobilien = {
|
||||
name: 'einsAImmobilien',
|
||||
enabled: config.sources.einsAImmobilien.enabled,
|
||||
url: config.sources.einsAImmobilien.url,
|
||||
crawlContainer: '.tabelle',
|
||||
crawlFields: {
|
||||
id: '.inner_object_data input[name="marker_objekt_id"]@value | int',
|
||||
price: '.tabelle .inner_object_data .single_data_price | removeNewline | trim',
|
||||
size: '.tabelle .inner_object_data .data_boxes div:nth-child(1)',
|
||||
rooms: '.tabelle .inner_object_data .data_boxes div:nth-child(2)',
|
||||
title: '.tabelle .inner_object_data .tabelle_inhalt_titel_black | removeNewline | trim',
|
||||
description: '.tabelle .inner_object_data .objekt_beschreibung | removeNewline | trim'
|
||||
},
|
||||
paginate: '.pagination_blocks div:last a@href',
|
||||
normalize: normalize,
|
||||
filter: applyBlacklist
|
||||
};
|
||||
|
||||
module.exports = new Fredy(einsAImmobilien);
|
||||
Reference in New Issue
Block a user