Steaming API with geocode locations


#1

Hi, I’m trying to filter a stream using geocode, but it keeps throwing out an error…
any advice would be much appreciated. thank you!

//…initialize required modules
var express = require(‘express’);
var app=express();
var http=require(‘http’);
var server=http.createServer(app);
var sys = require(“sys”);

//configure express as a typical web server

app.get("/", function(req, res) {
res.redirect("/index.html");
});

app.use(express.methodOverride());

app.use(express.bodyParser());

app.use(app.router);

app.use(express.static(process.cwd()+’/public’));

app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));

server.listen(process.env.PORT || 6789);
sys.puts(“server running at http://localhost:6789”);

//…twitter

var util = require(‘util’),
twitter = require(‘twitter’);
var twit = new twitter({
consumer_key: ‘x’,
consumer_secret: ‘x’,
access_token_key: ‘x’,
access_token_secret: ‘x’
});

twit.stream({locations:“42.3935871,-71.1068113,5km”},
function(stream) {
stream.on(‘data’, function(data) {
console.log(util.inspect(data.statuses));
});
setTimeout(stream.destroy, 5000);
});


#2

Hello,

Am I correct in thinking you are using the ntwitter Node module (https://github.com/AvianFlu/ntwitter)?

Please take a look at the examples, your problem may come from the parameters of the stream function, especially how you describe the bounding box for the coordinates.

Read more on [node:5892].