2012-05-29 132 views

回答

4

tweepy庫緊隨twitter API。該API返回的所有屬性都可用於結果對象;所以狀態信息,你需要看看tweet object description,看看他們有一個id參數:

for status in api.user_timeline(): 
    print status.id 

存儲最近id輪詢更新。

+0

謝謝,我會考慮這一點。 –

+0

api.user_timeline是什麼? – Veltro

+0

@Liam:[Twitter'狀態/ user_timeline'集合](https://dev.twitter.com/rest/reference/get/statuses/user_timeline)。另請參閱[Tweepy API文檔](http://tweepy.readthedocs.org/en/v3.2.0/api.html#timeline-methods)。 –

1

max_idsince_idapi.user_timeline()方法的參數。

使用tweepy.Cursor()對象可能是這個樣子:

tweets = [] 
    for tweet in tweepy.Cursor(api.user_timeline, 
         screen_name=<twitter_handle>, 
         since_id = <since_id> 
         ).items(<count>): 
     tweets.append(tweet) 
+0

如果你用多行tweepy格式化你的內聯好一點,這會更好看。遊標() –

+0

@ Danijel-JamesW隨意編輯!目前的格式是根據我的pep8 linter :) –

相關問題