Created
May 5, 2015 21:52
-
-
Save jamlfy/b7047cf9bd4179fbbce0 to your computer and use it in GitHub Desktop.
No doy descripcion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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