4

私は答えを求めてネットを検索してきましたが、単純な質問と思われるものは何も見つかりませんでした:

tweepy から「空白」検索を取得する方法はありますか?

たとえば、場所からすべてのツイートを取得します。

クエリ フィールドのないクエリを送信できません。

query=  tweepy.api.search(q="", rpp=1000)

戻り値:

tweepy.error.TweepError: クエリを入力する必要があります。

私が探しているのは、次のようなクエリを取得することです。

http://search.twitter.com/search.atom?geocode=38.376,-0.5,8km

すべてのツイートを取得...

4

1 に答える 1

7

qパラメータはオプションです( docsgeocodeを参照)。

これは私のために働く:

import tweepy

auth = tweepy.OAuthHandler(<consumer_key>, <consumer_secret>)
auth.set_access_token(<key>, <secret>)

api = tweepy.API(auth)

results = tweepy.api.search(geocode="38.376,-0.5,8km", rpp=1000)

for result in results:
    print result.text
    print result.location if hasattr(result, 'location') else "Undefined location"

それが役立つことを願っています。

于 2013-05-04T21:06:23.127 に答える