如何找到推特用户ID?

How to find twitter user id?

如何使用 ruby 推特 gem 从推文的状态 ID 获取推特用户的用户 ID?

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

我使用上面的代码获取推文 ID

如果你的tweetTwitter::Tweet对象,很简单:

tweet.user.id

以备不时之需 - 有几个可用的标识符:

tweet.user.screen_name  // the user's screen name
tweet.user.name         // the full name provided by user