3

I want to know how to get top tweeps by country.

ex : http://india.twirus.com/?category=india&freqtype=today

Tweeps = twitter People ;)

Ranking Logic : Top Mention profile for last 24hrs. *(You can also suggest me if you have any batter logic to get popular tweeps)

I tried twitter API but not able to find this one.

If there is no available api , you can also suggest possible logic.

Community
  • 1
  • 1
Ajay Patel
  • 5,298
  • 11
  • 55
  • 87
  • What is your ranking metric? Number of followers? Number of tweets? Number tweets retweeted? Number of mentions? Over what time period? – eggyal May 24 '12 at 12:38
  • @eggyal Number of mention for specif profile for last 24hrs (One day). – Ajay Patel May 24 '12 at 12:57
  • And when you say "tweeps by country", do you mean tweets by users which are *about* that country or were tweeted from *within* that country? – eggyal May 24 '12 at 13:14
  • @eggyal This : Mention tweeted from any country user, but top tweeps short by specific country. – Ajay Patel May 24 '12 at 13:23

2 Answers2

6

You must search for tweets that include all those of interest, then loop over the results creating a count for each user. Your problem then becomes a simple case of ordering the results.

Since there is a maximum of 100 results per request (and circa 1500 per paginated results), you will almost certainly have to chunk the results by specifying since_id and/or max_id parameters.

  • If you wish to obtain tweets about your country of interest, you can search by place (you will first have to use the geo search API to identify the place ID of your country of interest; in the case of India, the place ID is b850c1bfd38f30e0).

  • If you wish to obtain tweets from within your country of interest, you can specify a geocode parameter consisting of a point within the country and a radius sufficiently large to encompass the remainder of the country. Both elements can be obtained as a one-off exercise in the following manner:

    1. Identify a bounding polygon for the country of interest; these can be obtained from existing sources, for example from the CloudMade downloads site. In the case of India, the coordinates are available here.

    2. Find the minimum bounding circle for the polygon's vertices, remembering to use geographical distance in the calculations.

    If you wish to exclude tweets which are geotagged within the circle but outside the country's bounding polygon, for each resulting Tweet you must determine whether its coordinates lay within the polygon or not.

eggyal
  • 122,705
  • 18
  • 212
  • 237
  • Thanks @eggyal for grate suggestion. I have one question regarding the api request limitation twitter provide 250 rq/hr. Suppose i need to request more then that , what should i do ?(Ans expect different i.p) – Ajay Patel May 25 '12 at 12:22
1

Twitter has no API for this - Twirus collects their own data.

Possible logic: use the sample stream (or contact Twitter for access to better streams such as the gardenhose or firehose) and process all incoming tweets. You'll have to use math to determine in which country the tweet was posted. Then do the other obvious logic such as keeping a counter on the amount of mentions for a user.

Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105