Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to know the most followed accounts by the followers of a Twitter account?
    primarykey
    data
    text
    <p>I need to <strong>calculate the most followed accounts by the followers of a given account</strong>.</p> <p>I found a first answer but I've a strong limitations : the <strong>rate limit of <a href="https://dev.twitter.com/docs/api/1.1/get/friends/ids" rel="nofollow">friends/ids</a> API is 15 calls per 15 minutes</strong>. I can wait each time I hit the rate limit, but so, I need 10 hours to analyse a 600 followers Twitter account.</p> <pre class="lang-rb prettyprint-override"><code>require "rubygems" require "twitter" Twitter.configure do |config| config.consumer_key = CONSUMER_KEY config.consumer_secret = CONSUMER_SECRET config.oauth_token = OAUTH_TOKEN config.oauth_token_secret = OAUTH_TOKEN_SECRET end results = Hash.new(0) Twitter.follower_ids(TWITTER_ACCOUNT_TO_ANALYSE).ids.each do |account| Twitter.friend_ids(account).ids.each do |id| results[id] +=1 end end puts results.sort_by {|key, value| value}.inspect </code></pre> <p>Do you a know a more interesting way or API to calculate that ? An approximative answer can be suffisant for my use.</p> <p><strong>EDIT:</strong></p> <p>Here is a version that manage rate limit and don't display solitaire followings :</p> <pre><code>require "rubygems" require "twitter" Twitter.configure do |config| config.consumer_key = CONSUMER_KEY config.consumer_secret = CONSUMER_SECRET config.oauth_token = OAUTH_TOKEN config.oauth_token_secret = OAUTH_TOKEN_SECRET end results = Hash.new(0) Twitter.follower_ids(TWITTER_ACCOUNT_TO_ANALYSE).ids.each do |account| begin Twitter.friend_ids(account).ids.each do |id| results[id] +=1 end rescue Twitter::Error::TooManyRequests =&gt; error #rate limit sleep error.rate_limit.reset_in retry rescue Twitter::Error::Unauthorized =&gt; error #protected account next end end puts results.sort_by {|key, value| value}.keep_if {|key, value| value &gt; 1}.inspect </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload