Froren / realtorca

API wrapper for realtor.ca MLS website
199 stars 76 forks source link

i have issue please help #12

Open harishandroid opened 4 years ago

harishandroid commented 4 years ago

D:\nodecompile>node nodetest.js https://www.realtor.ca/Residential/Map.aspx#CultureId=1&ApplicationId=1&Property SearchTypeId=1&ReferenceNumber=N4615865 RequestError: Error: Parse Error: Invalid header value char at new RequestError (D:\nodecompile\node_modules\request-promise-core\lib\er rors.js:14:15) at Request.plumbing.callback (D:\nodecompile\node_modules\request-promise-co re\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (D:\nodecompile\node_modules\request-p romise-core\lib\plumbing.js:46:31) at self.callback (D:\nodecompile\node_modules\request\request.js:185:22) at Request.emit (events.js:311:20) at Request.onRequestError (D:\nodecompile\node_modules\request\request.js:87 7:8) at ClientRequest.emit (events.js:311:20) at TLSSocket.socketOnData (_http_client.js:483:9) at TLSSocket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:209:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) { name: 'RequestError', message: 'Error: Parse Error: Invalid header value char', cause: Error: Parse Error: Invalid header value char at TLSSocket.socketOnData (_http_client.js:476:22) at TLSSocket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:209:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) { bytesParsed: 979, code: 'HPE_INVALID_HEADER_TOKEN', reason: 'Invalid header value char', rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 70 72 69 76 61 74 65 0d 0a 43 6f 6e 74 65 6e 74 2d 4c ... 1402 more bytes> }, error: Error: Parse Error: Invalid header value char at TLSSocket.socketOnData (_http_client.js:476:22) at TLSSocket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:209:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) { bytesParsed: 979, code: 'HPE_INVALID_HEADER_TOKEN', reason: 'Invalid header value char', rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 70 72 69 76 61 74 65 0d 0a 43 6f 6e 74 65 6e 74 2d 4c ... 1402 more bytes> }, options: { method: 'POST', uri: 'https://api2.realtor.ca/Listing.svc/PropertySearch_Post', form: { CultureId: 1, ApplicationId: 1, PropertySearchTypeId: 1, ReferenceNumber: 'N4615865' }, json: true, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined }

D:\nodecompile>node nodetest.js https://www.realtor.ca/Residential/Map.aspx#LongitudeMin=-79.6758985519409&Longi tudeMax=-79.6079635620117&LatitudeMin=43.57601549736786&LatitudeMax=43.602250137 362276&PriceMin=100000&PriceMax=425000

D:\nodecompile>node nodetest.js https://www.realtor.ca/Residential/Map.aspx#LongitudeMin=-79.6758985519409&Longi tudeMax=-79.6079635620117&LatitudeMin=43.57601549736786&LatitudeMax=43.602250137 362276

D:\nodecompile>node nodetest.js https://www.realtor.ca/Residential/Map.aspx#CultureId=1&ApplicationId=1&Property SearchTypeId=1&ReferenceNumber=N4615865 RequestError: Error: Parse Error: Invalid header value char at new RequestError (D:\nodecompile\node_modules\request-promise-core\lib\er rors.js:14:15) at Request.plumbing.callback (D:\nodecompile\node_modules\request-promise-co re\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (D:\nodecompile\node_modules\request-p romise-core\lib\plumbing.js:46:31) at self.callback (D:\nodecompile\node_modules\request\request.js:185:22) at Request.emit (events.js:311:20) at Request.onRequestError (D:\nodecompile\node_modules\request\request.js:87 7:8) at ClientRequest.emit (events.js:311:20) at TLSSocket.socketOnData (_http_client.js:483:9) at TLSSocket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:209:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) { name: 'RequestError', message: 'Error: Parse Error: Invalid header value char', cause: Error: Parse Error: Invalid header value char at TLSSocket.socketOnData (_http_client.js:476:22) at TLSSocket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:209:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) { bytesParsed: 979, code: 'HPE_INVALID_HEADER_TOKEN', reason: 'Invalid header value char', rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 70 72 69 76 61 74 65 0d 0a 43 6f 6e 74 65 6e 74 2d 4c ... 1402 more bytes> }, error: Error: Parse Error: Invalid header value char at TLSSocket.socketOnData (_http_client.js:476:22) at TLSSocket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at TLSSocket.Readable.push (_stream_readable.js:209:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) { bytesParsed: 979, code: 'HPE_INVALID_HEADER_TOKEN', reason: 'Invalid header value char', rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 70 72 69 76 61 74 65 0d 0a 43 6f 6e 74 65 6e 74 2d 4c ... 1402 more bytes> }, options: { method: 'POST', uri: 'https://api2.realtor.ca/Listing.svc/PropertySearch_Post', form: { CultureId: 1, ApplicationId: 1, PropertySearchTypeId: 1, ReferenceNumber: 'N4615865' }, json: true, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined }

Froren commented 4 years ago

Can you paste your source code?

harishandroid commented 4 years ago

const realtor = require('realtorca');

let opts = { CultureId:1, ApplicationId:1, PropertySearchTypeId:1, ReferenceNumber:'N4615865'

};

console.log( realtor.buildUrl(opts) ); //https://www.realtor.ca/Residential/Map.aspx#LongitudeMin=-79.6758985519409&LongitudeMax=-79.6079635620117&LatitudeMin=43.57601549736786&LatitudeMax=43.602250137362276&PriceMin=100000&PriceMax=425000

realtor.post(opts) .then(data => { //json response console.log(data); }) .catch(err => { console.log(err); });

harishandroid commented 4 years ago

please help me..

harishandroid commented 4 years ago

it was working fine for long time. today only i got issue

Froren commented 4 years ago

I saw the same error when I was testing as well. It seems to have gone away now, can you confirm?

If it comes back I think I'll have ways to tinker with it and see what I can come up with to address it. Let me know if it's still an issue now or in the future.

harishandroid commented 4 years ago

now it is working fine. i have installed node js on two systems . two systems shows same error and i have uninstalled in one system and reinstalled node js and now it is working fine in two systems. i think because of ip issues i dont know for sure. But after uninstalling and reinstalling in one system it is working fine.

FrankFlitton commented 4 years ago

What version of Node are you using? I'm using v10.14.2 and getting the error with reference numbers also.

stuartathompson commented 4 years ago

This is an IP problem. I had the same issue, tried updating Node, same issue. Logged into my VPN and it worked.

Froren commented 4 years ago

While I was tinkering with this, I found that adding the some cookies with the request seemed to also fix the issue. Specifically, the ones prefixed with nlbi or incap_ses that you can find while making requests on realtor.ca.

I can see that the page also makes requests to an endpoint, https://www.realtor.ca/e8469ba99880590089b6cb783b503a90, which seems to be retrieving a possibly related token value.

Since it's a transient issue, I feel like it's just being experimented with (if at all), but I'm interested to see where this goes.

harishandroid commented 4 years ago

status code 403 is there any solution