How to get location of Tweets with search API?

mattfordham
@mattfordham Matt Fordham

The 'statuses/user_timeline' part of the API returns geolocation data as "place" along with each Tweet. The search API, on the other hand, does not return this location data (as far as I can tell). Is there a way to get location data with the search API?

2 years 22 weeks ago

Replies

kurrik
@kurrik Arne Roomann-Kurrik

Unfortunately the search API is fairly different from the rest of the REST APIs. We are working on getting them unified, but you'll need to treat the responses differently.

Some search API responses will contain a populated "geo" object:

  1.       "geo": {
  2.         "coordinates": [
  3.           40.6455,
  4.           -73.7757
  5.         ],
  6.         "type": "Point"
  7.       },

Others will contain a "location", pulled from the user's profile location info. Sometimes this has coordinates:

"location": "iPhone: 40.643913,-73.749466",

but other times it may be arbitrary:

"location": "YYZ - JFK",

If you want to limit search results to those with either of these, use the geocode parameter and set the radius to encompass the Earth.

2 years 22 weeks ago
mattfordham
@mattfordham Matt Fordham

Hmm. I posted a test tweet using the Twitter website's location feature then searched for it. "Geo" is empty:

http://search.twitter.com/search.json?q=A%20really%20specific%20test%20123&include_entities=true&result_type=mixed

On the other hand, the same Tweet on 'user_timeline' includes "place":

http://api.twitter.com/1/statuses/user_timeline.json?screen_name=TestPerson15&include_entities=true

2 years 21 weeks ago
jgoolam
@jgoolam Joe Goolam

If we just using the search API, we see geo field but never the actual location. Is it not true that this is only available in the stream APIs.

2 years 4 weeks ago
imminentedema
@imminentedema Supraja

don't all tweets have a location attached ? I get null to some getLocation() queries.

1 year 1 week ago
oyonas
@oyonas yoonas

but is it permitted to harvest geo location data, on another thread on this forum i read that is is against the terms of twitter...
dev.twitter.com/discussions/11835 ,

51 weeks 1 day ago
oyonas
@oyonas yoonas

https://dev.twitter.com/discussions/11835 , pls look at here and tell us if its okay

51 weeks 1 day ago
jamilshah20
@jamilshah20 jamil shah

plz tell that how i will location of a tweet of a sender

20 weeks 4 hours ago