Search code examples
rubytwitter

How to find twitter user id?


how do i get user id of a twitter user from the status id of their tweet using the ruby twitter gem?

most_recent = tweets.take(30)
most_recent.each do |tweet|
    tweet_id["#{tweet.id}"] = "#{tweet.text}"
end

I use the code above to get the tweet ids


Solution

  • If your tweet is Twitter::Tweet object, it is easy:

    tweet.user.id