diff --git a/plugins/twitter-stream-listener/Gemfile b/plugins/twitter-stream-listener/Gemfile new file mode 100644 index 0000000..6ab8219 --- /dev/null +++ b/plugins/twitter-stream-listener/Gemfile @@ -0,0 +1,3 @@ +source 'http://rubygems.org' + +gem 'twitter' diff --git a/plugins/twitter-stream-listener/Gemfile.lock b/plugins/twitter-stream-listener/Gemfile.lock new file mode 100644 index 0000000..4ecb5b5 --- /dev/null +++ b/plugins/twitter-stream-listener/Gemfile.lock @@ -0,0 +1,37 @@ +GEM + remote: http://rubygems.org/ + specs: + addressable (2.3.6) + atomic (1.1.16) + buftok (0.2.0) + equalizer (0.0.9) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) + http (0.5.0) + http_parser.rb + http_parser.rb (0.6.0) + json (1.8.1) + memoizable (0.4.2) + thread_safe (~> 0.3, >= 0.3.1) + multipart-post (2.0.0) + naught (1.0.0) + simple_oauth (0.2.0) + thread_safe (0.3.1) + atomic (>= 1.1.7, < 2) + twitter (5.8.0) + addressable (~> 2.3) + buftok (~> 0.2.0) + equalizer (~> 0.0.9) + faraday (~> 0.9.0) + http (~> 0.5.0) + http_parser.rb (~> 0.6.0) + json (~> 1.8) + memoizable (~> 0.4.0) + naught (~> 1.0) + simple_oauth (~> 0.2.0) + +PLATFORMS + ruby + +DEPENDENCIES + twitter diff --git a/plugins/twitter-stream-listener/stream.rb b/plugins/twitter-stream-listener/stream.rb new file mode 100644 index 0000000..6ad9880 --- /dev/null +++ b/plugins/twitter-stream-listener/stream.rb @@ -0,0 +1,36 @@ + +require 'twitter' +require 'json' + +#client = Twitter::REST::Client.new do |config| + + +client = Twitter::Streaming::Client.new do |config| + config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] + config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] + config.oauth_token = ENV['TWITTER_OAUTH_TOKEN'] + config.oauth_token_secret = ENV['TWITTER_OAUTH_TOKEN_SECRET'] +end + +topics = ["#nba"] + +client.filter(:track => topics.join(",")) do |object| + puts object.to_h.to_json if object.is_a?(Twitter::Tweet) +end + + + +#FACEBOOK + +#feed do participa +# precisa do access_token da comunidade participa.br +# com acesso a read_stream +# acessar https://developers.facebook.com/tools/explorer/ e Clicar no botão "Obter token de acesso" +# selecionar na aba Extended Permissions "read_stream" +#https://graph.facebook.com/me/feed?method=GET&format=json&suppress_http_code=1&access_token=ACCESS_TOKEN + +# imagem do usuário que postou: +# http://graph.facebook.com/517267866/picture?type=small +# http://graph.facebook.com/517267866/picture?type=normal +# http://graph.facebook.com/517267866/picture?type=large +# http://graph.facebook.com/517267866/picture?type=square -- libgit2 0.21.2