var request = require('request');
var cookie = null;
var say = function(msg, cb) {
request({
'url': 'http://www.simsimi.com/func/req?msg=' + encodeURIComponent(msg) + '&lc=zh',
'method': 'get',
'headers': {
'Cookie': cookie,
'Referer': 'http://www.simsimi.com/talk.htm'
}
}, function(error, response, body) {
console.log(error);
console.log(response);
console.log(body);
});
}
request({
'url': 'http://www.simsimi.com/talk.htm',
'method': 'get'
}, function(error, response, body) {
cookie = response.headers['set-cookie'];
cookie = (cookie + "").split(";").shift();
console.log(cookie);
say("hello");
}
我想通过 nodejs 获取 simsimi 但总是返回错误 { [Error: Parse Error] bytesParsed: 229, code: 'HPE_INVALID_HEADER_TOKEN' } 谁能解决;谢谢!!!