forked from ISNIT0/rightmove-scraper
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRightMoveScraper.js
22 lines (22 loc) · 1.05 KB
/
RightMoveScraper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var request = require('sync-request');
var db = require('mongojs').connect('test', ['rightmoveCodes']);
var outcodes = {};
db.rightmoveCodes.find({}, function(err, docs){
docs.map(function(val, index){
outcodes[val.outcode]=val.locationIdent;
});
});
module.exports = {
byOutcode:function(outcode, page){
return JSON.parse(request('GET', "http://api.rightmove.co.uk/api/sale/find?index="+page*100+"&sortType=2&numberOfPropertiesRequested=9999&locationIdentifier=OUTCODE%5E"+(outcodes[outcode]||outcode)+"&apiApplication=IPAD").getBody()).properties;
},
detail:function(id){
return JSON.parse(request('GET', "http://api.rightmove.co.uk:80/api/propertyDetails?propertyId="+id+"&apiApplication=IPAD").getBody());
},
areaDetail:function(outcode){
return JSON.parse(request('GET', "http://api.rightmove.co.uk/api/sale/find?index=0&sortType=2&numberOfPropertiesRequested=0&locationIdentifier=OUTCODE%5E"+(outcodes[outcode]||outcode)+"&apiApplication=IPAD").getBody());
},
rmLocIdentFromOutcode:function(outcode){
return outcodes[outcode];
}
};