Last active
December 31, 2015 17:29
-
-
Save haileys/8020232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_ids(ids) | |
$client.users(ids) | |
rescue Twitter::Error::NotFound => e | |
if ids.size == 1 | |
[] | |
else | |
a, b = ids[0...ids.length / 2], ids[ids.length / 2..-1] | |
get_ids(a) + get_ids(b) | |
end | |
end |
You should make the get_ids(a)
and get_ids(b)
requests in separate threads. That will make this code about twice as fast.
you probably will explode API limits pretty quickly too ..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LOL