Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a good way to select a random set of twitterers?

Considering the set of Twitter users "nodes" and the relation u follows v as the "edges", we have a graph from which I would like to select a subset of the users at random. I could be wrong, but from reading the API docs I think it's impossible to get a collection of users except by getting the followers or friends of an already-known user.

So, starting from myself and exploring the Twitter graph from there, what's a good way to select a random sample of (say 100) users?

like image 343
I. J. Kennedy Avatar asked Feb 06 '10 03:02

I. J. Kennedy


2 Answers

I would use the numerical user id. Generate a bunch of random numbers, and fetch users based on that. If you hit a nonexistent id, simply skip that.

The Twitter API wiki, for users/show:

id. The ID or screen name of a user.

like image 119
Joel L Avatar answered Sep 23 '22 11:09

Joel L


Twitter's streaming API has an endpoint called "Sample" which Returns a small random sample of all public statuses (cf. https://dev.twitter.com/docs/api/1.1/get/statuses/sample)

Authors twitter Ids are returned with the tweets, so this would get you random active twitter users.

like image 36
Mehdi Avatar answered Sep 22 '22 11:09

Mehdi