-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
34 lines (31 loc) · 811 Bytes
/
test.js
File metadata and controls
34 lines (31 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const LianjiaCrawler = require('./src/crawlers/lianjia');
const fs = require('fs');
let c = new LianjiaCrawler();
// c.getErshoufangDistrict('hf').then(v=>{
// console.log(JSON.stringify(v));
// });
// c.getErshoufangSection('hf', 'baohe').then(v=>{
// console.log(JSON.stringify(v));
// });
// c.getErshoufangSectionList('hf', 'baohe', 1).then(v=>{
// console.log(JSON.stringify(v.data));
// console.log(v.data.list.length);
// });
// c.getErshoufangDetail('bj', '101103624977').then(v=>{
//
// });
// let i = 0;
// c.getLoupanByCity('gz', v=>{
// if(v){
// i++
// }
// }).then(()=>{console.log(i)});
let ws = fs.createWriteStream('./gy.log', {flags: 'a'});
let i = 0;
c.getErshoufangByCity('gy', v=>{
ws.write(JSON.stringify(v)+'/n');
i++;
}).then(()=>{
ws.end();
console.log(i)
});