Demo code is broken
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.
I've been getting that error for quite a while as well. I tried re-installing all my modules but still broken.
take a look at the latest pull request. The API link has changed.. for whatever reason
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