简体   繁体   English

计算Twitter转推,关注者,收藏夹

[英]Counting Twitter Retweets, Followers, Favorites

I am using Twitter's REST API V1.1 and I need to count the number of followers for a specific time period eg I want to see how many users followed me from Feb to August 2013. And same for the favorites, retweets etc. 我正在使用Twitter的REST API V1.1,我需要计算特定时间段内关注者的数量,例如,我想查看2013年2月至2013年8月有多少用户关注了我。收藏夹,转发等内容也是如此。

Any guidance you can provide to access this type of data? 您可以提供访问此类数据的任何指导吗?

Thanks 谢谢

Gem 宝石

Since you're using Rails, I would recommend using the Twitter gem by sferik . 由于您使用的是Rails,因此建议您使用sferikTwitter gem This gem interfaces directly with the Twitter v1.1 API, and has all the hooks you require: 这个gem直接与Twitter v1.1 API交互,并具有您需要的所有挂钩:

Followers - client.friends("username") 关注者 client.friends("username")

Favourites - not sure 收藏夹 - not sure

Retweets - client.mentions_timeline 转推 client.mentions_timeline

I'm not sure how to only return time-constrained formats for this gem. 我不确定如何仅返回该gem的时间受限格式。 Failing a native ability to only pull the required data, you'll have to pull all the data & split for the required time period. 无法仅提取所需数据的本机功能,您将必须提取所有数据并在所需时间段内拆分。 However, this will very inefficient & expensive 但是,这将非常低效且昂贵


JS JS

This is the most efficient & "natural" way to access Twitter data in Rails. 这是在Rails中访问Twitter数据的最有效和“自然”的方式。 Failing that, there is a JS method called Twitterfetcher , which basically parases a Twitter Widget & allows you to display the content as required 失败的是,有一个称为Twitterfetcher的JS方法,该方法基本上将Twitter Widget置于伞下并允许您根据需要显示内容。

In addition to using the Gem provided in another answer, a solution to solving the number of users within a certain time span would be to first find your follower list. 除了使用另一个答案中提供的Gem,解决特定时间段内的用户数量的一种解决方案是首先找到您的关注者列表。 The gem must support this. 宝石必须支持这一点。 After authentication, make the get request as such 认证后,这样进行获取请求

GET followers/list

This will return a cursored collection of user objects for users following the specified user. 这将为跟随指定用户的用户返回用户对象的游标集合。 Read more Here 在这里阅读更多

The tricky part is the "created_at" field.. I'm not sure if this is a date of when the user created their twitter account, or the date of when the user started following you. 棘手的部分是“ created_at”字段。我不确定这是用户创建其Twitter帐户的日期还是用户开始关注您的日期。 You are most likely going to have to test this one for yourself, but I would start with reading through the twitter API documentation. 您很可能必须自己测试一下,但是我将从阅读Twitter API文档开始。

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

相关问题 使用twitter gem获取所有转发 - Getting all retweets with twitter gem 像Twitter追随者这样的关系/在ActiveRecord中关注 - Relationship like Twitter followers/followed in ActiveRecord 为什么在实施“收藏夹”时要采取错误的行动,模仿迈克尔·哈特尔(Michael Hartl)在Rails教程中的关注者/关注者 - Why submitting to wrong action when implementing “favorites”, modeled after Michael Hartl's following / followers in Rails Tutorial 搜索twitter client.favorites api,不知道如何使用它 - Searching for twitter client.favorites api, dont knw how to use it Ruby Twitter宝石追随者方法重复20次,而不是显示前20个追随者 - Ruby Twitter gem followers method repeating 20 times rather than displaying first 20 followers Twitter API - 获取我的关注者和关注者列表中常见的用户 - Twitter API - get users which are common in my following and followers list 是否有一个宝石可以缩短像Twitter这样的追随者? - Is there a gem to shorten large numbers like Twitter does for followers? 我想在我的示例twitter rails应用程序中找到所有关注者的推文 - I want find the tweets of all my followers in my sample twitter rails app @rails_folks | ” http://twitter.com/#!/user/followers” |请解释 - @rails_folks | ''http://twitter.com/#!/user/followers" | Please explain 建模收藏夹 - Modeling Favorites
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM