I'm doing a job and in it I need to collect the number of retweets and replys from 10 tweets from a Twitter user. In the code it is already possible to collect the number of followers and following by users and I have made an attempt to collect 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 can I collect retweets and replys?