how to collect retweets and replys from a ruby user

Asked

Viewed 93 times

3

I’m doing a job and in it I need to collect the number of retweets and replys of 10 tweets from a Twitter user. In the code it is already possible to collect the number of followers and following users and I made an attempt to collect the retweets of 10 tweets from each user, but it is not working.

    client = Twitter::REST::Client.new do |config|

    config.consumer_key = "xxx"
    config.consumer_secret = "yyy"
    config.access_token = "zzz"
    config.access_token_secret = "www"

     client.search(":(", :lang => "pt", :result_type => "recent", :exclude => "retweets").take(10).collect do |tweet|
       dif = tweet.user.followers_count - tweet.user.friends_count
       puts "Name: #{tweet.user.screen_name} - Follower: #{tweet.user.followers_count} - Following: #{tweet.user.friends_count} - Difference: #{dif}"
       tweet.user.search(:result_type => "recent").take(10).collect do |tweet|
          count = tweet.retweet_count
          puts "Retweets de 10 tweets: #{count}"
       end
     end

How do I get to collect the retweets and replys?

  • 2

    Maybe you want to run your Twitter Services API...

  • You have to go after the twitter api

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.