web-dev-qa-db-ja.com

Twitter API:ジオタグ付きツイートのみを検索する方法

Twitter Search API(またはその他)を使用して、"geo" param?

-編集-

例:#Appleタグでジオタグ付きツイートのリストを取得しません。場所フィルターなし、世界中。

23
bnetangel

最新のAPIでサポートされているようです。クエリに十分な大きさの地域を使用するだけです。

-180,-90,180,90

filter and location の詳細については、APIリンクをご覧ください。

12
asksw0rder

ストリーミングAPIでは場所でフィルタリングでき、検索APIではジオコードで検索できます。これらのサービスの詳細については、開発者向けリソースサイトをご覧ください。

ストリーミングAPI: http://dev.Twitter.com/pages/streaming_api

例:「locations」という名前のファイルを作成します。このファイルには、引用符を除いて、「locations = -122.75,36.8、-121.75,37.8、-74,40、-73,41」というフレーズが含まれています。

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

サンフランシスコとニューヨークのエリアから、すべてのgeoタグ付きツイートを受け取ります。

検索API: http://dev.Twitter.com/doc/get/search

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

9
Dennis G

から Twitter APIドキュメント、これは検索クエリの形式である必要があります。

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

どこ 37.781157は緯度、-122.398720は経度であり、1miは、検索する半径です。

5
Jasdeep Singh

すべてのツイートを検索できますが、ジオタグ付きのツイートのみを保存できます。私はそれがあまり意味をなさないことを知っていますが、かなりうまくいきます。

検索結果を呼び出す場合は、

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
user7779