私はTwitterから映画のレビューを集めようとしています。しかし、私はたった76のつぶやきしか得られません。私はtweeterrorを除いて試みたが、それは助けにならない。ここに私のコードはあります:Tweepyが返すのは76個のつぶやきだけです
import tweepy
import time
import cPickle as pickle
auth = tweepy.OAuthHandler(**hidden**)
auth.set_access_token(**hidden**)
api = tweepy.API(auth)
def limit_handled(cursor):
while True:
try:
yield cursor.next()
"I am awake..."
except tweepy.error:
print "going to sleep..."
time.sleep(15 * 60)
except StopIteration:
break
query = '#moviereview -filter:links'
max_tweets = 1000000
searched_tweets = [status.text for status in limit_handled(tweepy.Cursor(api.search, q=query).items(max_tweets))]
with open("twitter_reviews.pkl","wb") as f:
pickle.dump(searched_tweets,f,-1)
print len(searched_tweets)
あなたは何個のつぶやきを期待していましたか?エラーメッセージを追加できますか? – glls
エラーはありません。私は唯一の72のつぶやき –
を取得し、あなたはどれくらい期待していますか? – glls