realtorca icon indicating copy to clipboard operation
realtorca copied to clipboard

Demo code is broken

Open FGasper opened this issue 4 years ago • 3 comments

When I try your demo locally:

const realtor = require('./realtorca');

let opts = {
    ReferenceNumber: "W5254257",
};

opts = {
  LongitudeMin: -79.6758985519409,
  LongitudeMax: -79.6079635620117,
  LatitudeMin: 43.57601549736786,
  LatitudeMax: 43.602250137362276,
  PriceMin: 100000,
  PriceMax: 410000
};

console.log( realtor.buildUrl(opts) );

realtor.post(opts)
  .then(data => {
    console.log(data);
  })
  .catch(console.error);

… I get an HTTP 403.

Does this tool still work? It seems to depend on behaviour that I suspect the powers-that-be in Toronto RE want not to work.

FGasper avatar Jun 01 '21 12:06 FGasper

I've been getting that error for quite a while as well. I tried re-installing all my modules but still broken.

VancouverJohn avatar Jun 02 '21 17:06 VancouverJohn

take a look at the latest pull request. The API link has changed.. for whatever reason

FengqiuAdamDong avatar Oct 03 '21 01:10 FengqiuAdamDong

From what I can tell they updated the API domain and added some very easily spoofable headers. I think the new domain is: api2.realtor.ca instead of api37.realtor.ca.

The headers that I used for the search request are: {"Referer": "https://www.realtor.ca/", "Origin": "https://www.realtor.ca/", "Host": "api2.realtor.ca"}

I haven't tested the listing details endpoint, but this seems to work for me

mcgeddes11 avatar Sep 01 '22 02:09 mcgeddes11