Skip to content

Instantly share code, notes, and snippets.

@jamlfy
Created May 5, 2015 21:52
Show Gist options
  • Select an option

  • Save jamlfy/b7047cf9bd4179fbbce0 to your computer and use it in GitHub Desktop.

Select an option

Save jamlfy/b7047cf9bd4179fbbce0 to your computer and use it in GitHub Desktop.
No doy descripcion
const um =/(^|\s)(3([0-9]|\-){9,10})($|\s)/gim;
const search = 'lo que buscamos basico';
const _ = require('underscore');
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: ,
consumer_secret: ,
access_token_key: ,
access_token_secret:
});
client.stream('statuses/filter', {
track : search,
//locations: '4.283435,-74.22404'
}, function(stream) {
stream.on('data', function(tweet) {
var matchs = tweet.text.match(um) || [];
if(tweet.user.description)
matchs = _.union(matchs, tweet.user.description.match(um) );
if(tweet.retweeted_status){
matchs = _.union(matchs, tweet.retweeted_status.text.match(um) );
if(tweet.retweeted_status.user.description)
matchs = _.union(matchs, tweet.retweeted_status.user.description.match(um) );
}
if(matchs && matchs.length){
for (var i = matchs.length - 1; i >= 0; i--)
console.log(tweet.user.screen_name, matchs[i]);
}
});
stream.on('error', function(error) {
throw error;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment