Skip to content

Instantly share code, notes, and snippets.

@fredoliveira
Created June 3, 2012 15:59
Show Gist options
  • Save fredoliveira/2863983 to your computer and use it in GitHub Desktop.
Save fredoliveira/2863983 to your computer and use it in GitHub Desktop.
Remove 80% of mention false positives from twitter
require 'rubygems'
require 'tweetstream'
require 'colorize'
regex = /@[f][\.\,\:]?\s/
TweetStream.configure do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
config.auth_method = :oauth
end
client = TweetStream::Client.new
client.userstream do |status|
if status.text =~ regex
puts "#{status.user.screen_name}: ".green + status.text
else
puts "#{status.user.screen_name}: ".black + status.text.black
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment