tdurieux / leboncoin-api

DEPRECATED
https://www.npmjs.com/package/leboncoin-api
169 stars 54 forks source link

TypeError: Cannot read property 'value' of undefined #37

Closed sybaris closed 4 years ago

sybaris commented 6 years ago

Hello

When I try the example provided in main page (https://github.com/tdurieux/leboncoin-api), I have the following error :


C:\lbc\node_modules\leboncoin-api\lib\search.js:235
            searchLabel = searchId[0].value;
                                      ^

TypeError: Cannot read property 'value' of undefined
    at search.map.searchLabel (C:\lbc\node_modules\leboncoin-api\lib\search.js:235:39)
    at Array.map (<anonymous>)
    at getIdsForLabels (C:\lbc\node_modules\leboncoin-api\lib\search.js:232:21)
    at _.forEach (C:\lbc\node_modules\leboncoin-api\lib\search.js:277:30)
    at C:\lbc\node_modules\lodash\lodash.js:4911:15
    at baseForOwn (C:\lbc\node_modules\lodash\lodash.js:2996:24)
    at C:\lbc\node_modules\lodash\lodash.js:4880:18
    at Function.forEach (C:\lbc\node_modules\lodash\lodash.js:9344:14)
    at LodashWrapper.object.(anonymous function) [as forEach] (C:\lbc\node_modules\lodash\lodash.js:15716:25)
    at getSubCategoriesExtras (C:\lbc\node_modules\leboncoin-api\lib\search.js:269:21)
    at Search.getBodyParams (C:\lbc\node_modules\leboncoin-api\lib\search.js:324:22)
    at Search.run (C:\lbc\node_modules\leboncoin-api\lib\search.js:369:51)
    at Object.<anonymous> (C:\lbc\lbc.js:18:8)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)

Any idea why ? Thanks for advance. Sybaris

tdurieux commented 6 years ago

That is strange, I never faced this error. And the example is working right now :/ I will try to fix this. Thanks for the report.

sybaris commented 5 years ago

Hi,

Removing the 2 lines .addSearchExtra, now it works. It seems that it don't like ".addSearchExtra('furnished', ["1", "Non meublé"])" Perharps the "é" ? I am running on an english windows...

Regards, Sybaris