Commit 9a901eef0853775c13ede048de6547922a657537

Authored by Evandro Junior
1 parent 49e7109d

looking for file problems

plugins/twitter-stream-listener/Gemfile 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +source 'http://rubygems.org'
  2 +
  3 +gem 'twitter'
... ...
plugins/twitter-stream-listener/Gemfile.lock 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +GEM
  2 + remote: http://rubygems.org/
  3 + specs:
  4 + addressable (2.3.6)
  5 + atomic (1.1.16)
  6 + buftok (0.2.0)
  7 + equalizer (0.0.9)
  8 + faraday (0.9.0)
  9 + multipart-post (>= 1.2, < 3)
  10 + http (0.5.0)
  11 + http_parser.rb
  12 + http_parser.rb (0.6.0)
  13 + json (1.8.1)
  14 + memoizable (0.4.2)
  15 + thread_safe (~> 0.3, >= 0.3.1)
  16 + multipart-post (2.0.0)
  17 + naught (1.0.0)
  18 + simple_oauth (0.2.0)
  19 + thread_safe (0.3.1)
  20 + atomic (>= 1.1.7, < 2)
  21 + twitter (5.8.0)
  22 + addressable (~> 2.3)
  23 + buftok (~> 0.2.0)
  24 + equalizer (~> 0.0.9)
  25 + faraday (~> 0.9.0)
  26 + http (~> 0.5.0)
  27 + http_parser.rb (~> 0.6.0)
  28 + json (~> 1.8)
  29 + memoizable (~> 0.4.0)
  30 + naught (~> 1.0)
  31 + simple_oauth (~> 0.2.0)
  32 +
  33 +PLATFORMS
  34 + ruby
  35 +
  36 +DEPENDENCIES
  37 + twitter
... ...
plugins/twitter-stream-listener/stream.rb 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +
  2 +require 'twitter'
  3 +require 'json'
  4 +
  5 +#client = Twitter::REST::Client.new do |config|
  6 +
  7 +
  8 +client = Twitter::Streaming::Client.new do |config|
  9 + config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
  10 + config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
  11 + config.oauth_token = ENV['TWITTER_OAUTH_TOKEN']
  12 + config.oauth_token_secret = ENV['TWITTER_OAUTH_TOKEN_SECRET']
  13 +end
  14 +
  15 +topics = ["#nba"]
  16 +
  17 +client.filter(:track => topics.join(",")) do |object|
  18 + puts object.to_h.to_json if object.is_a?(Twitter::Tweet)
  19 +end
  20 +
  21 +
  22 +
  23 +#FACEBOOK
  24 +
  25 +#feed do participa
  26 +# precisa do access_token da comunidade participa.br
  27 +# com acesso a read_stream
  28 +# acessar https://developers.facebook.com/tools/explorer/ e Clicar no botão "Obter token de acesso"
  29 +# selecionar na aba Extended Permissions "read_stream"
  30 +#https://graph.facebook.com/me/feed?method=GET&format=json&suppress_http_code=1&access_token=ACCESS_TOKEN
  31 +
  32 +# imagem do usuário que postou:
  33 +# http://graph.facebook.com/517267866/picture?type=small
  34 +# http://graph.facebook.com/517267866/picture?type=normal
  35 +# http://graph.facebook.com/517267866/picture?type=large
  36 +# http://graph.facebook.com/517267866/picture?type=square
... ...