私はこのコードをクライアント上にツイッターからJSONのストリームを取得することができるよ:解析JSON値
var command = 'curl -d @tracking https://stream.twitter.com/1/statuses/filter.json -uUsername:Password'
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
child = exec(command);
child.stdout.on('data', function(data) {
res.write(data);
});
}).listen(1337, "127.0.0.1");
が、私は「テキスト」か」を取得することはできませんid 'の値をJSONから取得します。私は、このようなこのようなコードとしてjQueryのparsJSON()、および他のものを使用して試してみた: ':オブジェクトオブジェクトの
var command = 'curl -d @tracking https://stream.twitter.com/1/statuses/filter.json -uUsername:password'
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
child = exec(command);
child.stdout.on('data', function(data) {
for (i=0; i<data.length; i++) {
reduceJSON = data[i]["text"]
stringJSON = String(reduceJSON)
res.write(stringJSON);
}
});
}).listen(1337, "127.0.0.1");
私は「未定義」または「readyStatesetRequestHeadergetAllResponseHeadersgetResponseHeader」またはのストリームを取得しておきます。誰もが個々の値を取得する方法を知っていますか?
なぜノード要求ライブラリの代わりにCURLとexecを使用していますか? – loganfsmyth