Please help me with extracting followers! Thanks.

41 views
Skip to first unread message

Roger

unread,
Aug 16, 2015, 2:04:05 PM8/16/15
to Twitter Ruby Gem
Hi,

I'm trying to learn how to extract someone's twitter followers for a project, and I'm having a bit of difficulty... I am not a Ruby programmer, so please be gentle and explain it to me like I'm a child.

I have the twitter gem & ruby installed and confirmed to be working, I have a twitter app and the correct keys...

So, I started with this script https://gist.github.com/sferik/9630519 which seems to work well until it hits the rate limit, at which point it crashes. with the error "/var/lib/gems/1.9.1/gems/twitter-5.14.0/lib/twitter/rest/response/raise_error.rb:15:in `on_complete': Rate limit exceeded (Twitter::Error::TooManyRequests)"
I have also tried this script https://gist.github.com/ronhornbaker/7817176 which works for a while then throws up the error "`rescue in fetch_all_friends': private method `next_cursor' called for #<Twitter::Cursor:0x00000001d58c38> (NoMethodError)".
However, when I run the script again, I do get the message 
"0 done from rescue block...
Hit rate limit, sleeping for 182...
Hit rate limit, sleeping for 182...
Hit rate limit, sleeping for 182..."
Before it collects some more data and then crashes again.

The first script collects about 18,000 records before halting, as opposed to 1-2000 for the second, so ideally I'd like to move a working rate limit handling feature into the first script.

Can you advise please?

Thanks!

Reply all
Reply to author
Forward
0 new messages