简体   繁体   English

如何通过Tweetstream Ruby gem获得Twitter的关注请求?

[英]How do I get Twitter follow request with the Tweetstream Ruby gem?

According to this Ars Technica tutorial, "the streaming API makes it easy to detect when the user gets a new follower. To detect follow event objects, look for the "event" key and check if it has the string "follow" as the value." 根据Ars Technica的这篇教程,“流式API可以轻松检测用户何时获得新关注者。要检测关注事件对象,请查找“ event”键,并检查其是否包含字符串“ follow”作为值。”

http://arstechnica.com/information-technology/2010/04/tutorial-use-twitters-new-real-time-stream-api-in-python/2/ http://arstechnica.com/information-technology/2010/04/tutorial-use-twitters-new-real-time-stream-api-in-python/2/

The tweetstream gem supposedly exposes all methods from the API. 据推测,tweetstream gem公开了API中的所有方法。 However I can't figure out, how to get to those follow requests! 但是我不知道如何获得这些关注请求!

Any ideas? 有任何想法吗?

The tweetstream gem is fairly complete, but sometimes you need to delve into the source to find stuff: tweetstream gem非常完整,但是有时您需要深入研究源代码以查找内容:

client.on_event(:follow) do |event|
  p event[:source][:screen_name]
end

https://github.com/intridea/tweetstream/blob/master/lib/tweetstream/client.rb#L375 :) https://github.com/intridea/tweetstream/blob/master/lib/tweetstream/client.rb#L375 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM