0
有一些關於如何使用Twitter API從用戶獲取推文的問題。 (例如,Twitter API getting any user's all tweets,Is there a way to get all tweets from twitter for a specified user?)如何使用Twitter API從用戶那裏獲得'許多'推文
我知道我應該使用user_timeline。但我的問題是,Twitter提出了一個速率限制,如果我想下載一次1000個推文,它會給我一個錯誤。
在下面的代碼中,我向API提出了單獨的請求,並在每個請求之間休眠了幾分鐘,但它仍然無法工作。
for p in range(1, 6):
params['page'] = p
url = base_url + urllib.urlencode(params)
r = requests.get(url)
j = simplejson.loads(r.content)
for item in j:
# do something to tweets
time.sleep(180)
任何想法的工作?謝謝。