3

I've been playing around with the R twitteR package and haven't figured out how to implement a system to collect more than the maximum per hour # of followers for a twitter user.
I know the plan should be to collect the maximum, wait X amount of time, then repeat until all are collected, but how do I do this with the twitteR package?
the getFollowers(n) process would just keep getting the same n followers each time.

oz123
  • 27,559
  • 27
  • 125
  • 187
John McKay
  • 31
  • 1
  • 2
  • I had the same problem and made a loop that paused every 60 secs, maybe that will solve your problem? You can see the loop here: http://stackoverflow.com/a/9950670/1036500 – Ben Mar 24 '13 at 23:50
  • Thanks a bunch man - That might be EXACTLY what I was looking for though let me try it out – John McKay Mar 26 '13 at 06:37
  • 1
    Thanks a bunch - that's definitely a template I can use. What if instead of twitter follower counts I wanted the actual follower ids for each user?? How could I break that down to do something like "get 1000 followers - wait x seconds - repeat until done" – John McKay Mar 26 '13 at 06:54
  • @JohnMcKay - is this code something that you can share? – pulkitsinghal Mar 02 '15 at 02:44

1 Answers1

3

Try adding blockOnRateLimit=TRUE to your call. It'll sit and wait until it can complete (which could be a long time depending on the size of your request). It is a 'hidden' arg as I wasn't sure if I wanted to keep it the way it is or not - and in fact it is almost certainly going to change somewhat for the next version but for now it should get you where you need to go.

geoffjentry
  • 4,674
  • 3
  • 31
  • 37
  • AHH Thanks so much! Just so I do this right - where do I use this arg, ie do I use it: getUser("name")$getFollowers(blockOnRateLimit=TRUE) – John McKay Mar 27 '13 at 06:21
  • To get the count of followers it should be something like this: `getUser("user", cainfo="cacert.pem", blockOnRateLimit=TRUE)$followersCount`(assuming you've registered your OAuth credentials as in here: http://stackoverflow.com/q/9916283/1036500) – Ben Mar 27 '13 at 09:39
  • I'm not in a position to test this but I think John's is probably the correct one (in terms of where to put the blockOnRateLimit). Really you could put it in both places, but if he's being blocked getting followers that's the one you want to block on. – geoffjentry Mar 27 '13 at 18:22
  • @geoffjentry I´m getting this error using the code provided in the comment: Client Error (429) – marbel Mar 26 '14 at 21:38