2

Need 1000 twitter handles of users who are below 21 years of age and residing in US

  • Age data isn't available on Twitter. You could deduce from profile descriptions as to a person's ages, for example if they write something like "21/m/London" then you can guess that they might be 21. – Oliver Frost May 17 '16 at 9:37
  • That is what I was thinking, but i would still need a large amount of handles to narrow down to 1000 users with their ages. – Chirag Kanase May 17 '16 at 10:10
3

I don't think there is a specific method for what you are asking for. There are some methods of acquiring a large number of handles, although they each come with downsides. I typically use the twitteR package in R to make API requests to the Twitter REST API to get this data.

On the Twitter REST API, you can make requests for:

  1. Tweets based on a search term.

With the GET search/tweets method, you can get up to 3200 tweets for a particular search term. You could run lots of different requests with different search terms to remove bias where possible, and collect a random sample of 1000 handles that appear under 21.

  1. Get a specific user's followers.

GET followers/ids. Could be a quicker and easier option, especially if you use a popular Twitter user. However you are left with the problem that your entire sample is bunrepresentative in that they follow the same person, unless you collect a few different users' followers. There is a very simple method in R for this:

user <- getUser("justinbieber") # will probably return a lot of <21's based in the US.
user.followers <- lookupUsers(user$getFollowerIDs())
user.followers <- twListToDF(user.followers)

If you help with the specifics of getting the data itself (i.e. if you are not already comfortable with making API requests), I can possibly help in the comments.

From https://dev.twitter.com/rest/public

  • I have tried the Twitter REST api method in R like you mentioned. Whenever I try to get the followers, R gives rate limit reached warning. This was for about 36k followers. Justin Bieber has about 1.7M followers. R will definitely give the same error. – Chirag Kanase May 17 '16 at 11:16
  • I am not quite sure how the lookupUsers() function works in terms of pagination of results. But according to the docs, you should be able to get up to 5000 users per unique request by using the GET followers/id method on its own. FYI, the rate limit refreshes every 15 minutes. – Oliver Frost May 17 '16 at 11:23
  • Perhaps you should consider option 1, looping through a list of predefined search terms, that way you can make 180 requests per 15 minutes and are less likely to hit the rate limit before collecting a substantial amount of tweets (and the handles attached). – Oliver Frost May 17 '16 at 11:29
3

As mentioned above, Twitter has no searchable age category, but there are some clever ways to deduce

Filter on first names that barely existed more than 21 years ago. For example, Harper.

enter image description here

You can find tons of Millenial names on one of the million baby name blogs or sites (for example).

The Twitter API or Advanced Search allows you to search within a geographical bounding box, to filter for certain languages ("lang:en") and to either download from the public stream, or to search based on certain terms. You can test out in the browser advanced search queries and then use the search parameters from the response URL with the API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.