mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fixing immowelt crawler
This commit is contained in:
@@ -3,7 +3,7 @@ const config = require('../../conf/config.json');
|
|||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
|
|
||||||
function normalize(o) {
|
function normalize(o) {
|
||||||
const size = o.size.split('Wohnfläche')[0];
|
const size = o.size.split('Wohnfläche')[1].replace(' (ca.) ', '');
|
||||||
const address = o.address;
|
const address = o.address;
|
||||||
|
|
||||||
return Object.assign(o, { size, address });
|
return Object.assign(o, { size, address });
|
||||||
@@ -24,11 +24,10 @@ const immowelt = {
|
|||||||
crawlFields: {
|
crawlFields: {
|
||||||
id: '@data-estateid | int',
|
id: '@data-estateid | int',
|
||||||
price: '.hardfacts_3 strong | removeNewline | trim',
|
price: '.hardfacts_3 strong | removeNewline | trim',
|
||||||
size: '.hardfacts_3 div:nth-child(2):not(.hardfactlabel)| removeNewline | trim',
|
size: '.js-object.listitem_wrap .hardfacts_3 div:nth-child(2)| removeNewline | trim',
|
||||||
title: '.listcontent.clear h2',
|
title: '.listcontent.clear h2',
|
||||||
link: 'a@href',
|
link: 'a@href',
|
||||||
description: '.listconten_offset .listmerkmale| removeNewline | trim',
|
address: '.listcontent .details .listlocation| removeNewline | trim'
|
||||||
address: '.listconten_offset .listlocation| removeNewline | trim'
|
|
||||||
},
|
},
|
||||||
paginate: '#pnlPaging #nlbPlus@href',
|
paginate: '#pnlPaging #nlbPlus@href',
|
||||||
normalize: normalize,
|
normalize: normalize,
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ describe('#immowelt testsuite()', () => {
|
|||||||
immoweltDbContent.immowelt[idx]
|
immoweltDbContent.immowelt[idx]
|
||||||
);
|
);
|
||||||
expect(notify.price).that.does.include('€');
|
expect(notify.price).that.does.include('€');
|
||||||
|
if(notify.size.trim().toLowerCase() !== 'k.a.') {
|
||||||
expect(notify.size).that.does.include('m²');
|
expect(notify.size).that.does.include('m²');
|
||||||
|
}
|
||||||
expect(notify.title).to.be.not.empty;
|
expect(notify.title).to.be.not.empty;
|
||||||
expect(notify.link).that.does.include('https://www.immowelt.de');
|
expect(notify.link).that.does.include('https://www.immowelt.de');
|
||||||
expect(notify.address).to.be.not.empty;
|
expect(notify.address).to.be.not.empty;
|
||||||
|
|||||||
Reference in New Issue
Block a user