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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With