有没有一种简单的方法可以使用ruby gem获得twitter的推荐?

有没有一种简单的方法可以使用ruby gem获得twitter的推荐?,ruby,twitter,sinatra,tweetstream,grackle,Ruby,Twitter,Sinatra,Tweetstream,Grackle,我尝试过使用gem,但我不知道如何获得用户@提及流 我就是想不出如何把一段代码放在一起,上面写着“把所有提到的内容都告诉用户”。(我想点击@antify,而不仅仅是在twitter上搜索用户名) 我正在使用Sinatra::我已经准备好并运行了::我可以发布到提要,获取特定状态等等。我无法得到@提及 我只使用宝石,但这是你可以做到的。 既然你可以发布feed,我想你就有了访问令牌的过程 >> response = access_token.get('http://api.twitte

我尝试过使用gem,但我不知道如何获得用户@提及流

我就是想不出如何把一段代码放在一起,上面写着“把所有提到的内容都告诉用户”。(我想点击@antify,而不仅仅是在twitter上搜索用户名)

我正在使用Sinatra::我已经准备好并运行了::我可以发布到提要,获取特定状态等等。我无法得到@提及

我只使用宝石,但这是你可以做到的。 既然你可以发布feed,我想你就有了访问令牌的过程

>> response = access_token.get('http://api.twitter.com/1/statuses/mentions.json')
>> JSON.parse(response.body)
#=> Array of Hashes with all the info
顺便说一下,我看到源代码中已经包含了一个函数

tweet.rb

# @note Must include entities in your request for this method to work
# @return [Array<Twitter::Entity::UserMention>]
def user_mentions
  @user_mentions ||= entities(Twitter::Entity::UserMention, :user_mentions)
end
#@注意,您的请求中必须包含实体才能使用此方法
#@return[Array]
def user_提到
@用户提到| |=实体(Twitter::实体::用户提到,:用户提到)
结束

您可以使用Twitter上的search/tweets API并设置q:“@USERNAME”,它将查找提及您用户的tweet。

也许dev.Twitter上的获取状态/提及页面会有所帮助: