Twitter API: How to search only for geotagged tweets

后端 未结 5 921
傲寒
傲寒 2021-02-01 18:27

How can I use Twitter Search API (or other) to get a list of tweets which have the \"geo\" param?

--EDIT--

By example: I wont get list

相关标签:
5条回答
  • 2021-02-01 18:39

    Use -180,-90,180,90 to get any geotagged tweet.

    0 讨论(0)
  • 2021-02-01 18:45

    You can look for every tweet but save only the geotaged ones. I know it dont make a lot of sense, but works quite well.

    if you call you search results, you can state

    for result in results:
        if result.geo != None:
            print result.text.encode('utf-8', errors='ignore')  # or do anything you want with the tweets
    
    0 讨论(0)
  • 2021-02-01 18:48

    Looks like the latest API supports that; simply use a large enough geo region for your query:

    -180,-90,180,90
    

    See more from the API link for filter and location

    0 讨论(0)
  • 2021-02-01 18:52

    The streaming API allowed you to filter by a location and the search API allows you to search by geocode. You can find more information on these services on our developer resources site.

    Streaming API: http://dev.twitter.com/pages/streaming_api

    Example: Create a file called ‘locations’ that contains, excluding the quotation marks, the phrase: “locations=-122.75,36.8,-121.75,37.8,-74,40,-73,41” then execute:

    curl -d @locations http://stream.twitter.com/1/statuses/filter.json -uAnyTwitterUser:Password.

    You will receive all geo tagged tweets from the San Francisco and New York City area.

    Search API: http://dev.twitter.com/doc/get/search

    Example: http://search.twitter.com/search.json?geocode=37.781157,-122.398720,1mi

    0 讨论(0)
  • 2021-02-01 18:59

    From the Twitter API Documentation, this should be the format of your search query:

     http://search.twitter.com/search.json?geocode=37.781157,-122.398720,1mi
    

    Where 37.781157 is the latitude, -122.398720 is the longitude and 1mi is the radius to search within.

    0 讨论(0)
提交回复
热议问题