-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
18 lines (17 loc) · 688 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var request = require('request'),
tagsCode = require('./lib/tags_code.json'),
display = require('./lib/display');
utils = require('./lib/utils');
module.exports = function(imagesCount) {
//Baidu image
var pn = Math.floor(Math.random() * 200);
//console.log ('pn : ' + pn);
var randomTag = utils.getRandomString(10);
var url = 'http://image.baidu.com/channel/listjson?pn=' + pn + '&rn=200&tag1=美女&tag2=全部';
request.get(url + '&ftags=' + randomTag, function (error, response, data) {
if (!error && response.statusCode == 200) {
// console.log('data: ' + data);
display.images(data, imagesCount);
}
});
};