adriankumpf / findmeaflat

Get notified of new listings on popular German real estate portals.
22 stars 6 forks source link

Kleinanzeigen scraper rules issue #21

Closed unsusp-spec closed 3 years ago

unsusp-spec commented 3 years ago

Hi,

when I try to run the bot, I get the error

Caught Error: TypeError: Cannot read property 'split' of undefined
    at normalize (~/findmeaflat/lib/sources/kleinanzeigen.js:7:21)
    at Array.map (<anonymous>)
    at FlatFinder.run (~/findmeaflat/lib/flatfinder.js:22:8)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Promise.all (index 3) {
  [stack]: "TypeError: Cannot read property 'split' of undefined\n" +
    '    at normalize (~/findmeaflat/lib/sources/kleinanzeigen.js:7:21)\n' +
    '    at Array.map (<anonymous>)\n' +
    '    at FlatFinder.run (~/findmeaflat/lib/flatfinder.js:22:8)\n' +
    '    at runMicrotasks (<anonymous>)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:94:5)\n' +
    '    at async Promise.all (index 3)',
  [message]: "Cannot read property 'split' of undefined"

However, if I replace the line const address = o.address.split('\n')[4].trim()

in lib/sources/kleinanzeigen.js by

const address = o.address

the bot works fine.

Cheers!

adriankumpf commented 3 years ago

Good catch, @unsusp-spec! I will take a look at it when I have time. Feel free to create a PR with the fix in the meantime :)

xu-chris commented 3 years ago

PR #22 should solve this.

xu-chris commented 3 years ago

Addressed again in PR #25

adriankumpf commented 3 years ago

Fixed by #25