Getting Twitter home timeline tweets

2019-04-12 20:18发布

I am using Twitters REST api for the first time and I am a little confused by their documentation. I want to poll their API every ten minutes (to avoid the rate limits), retrieve the previous ten minutes of tweets and then do some processing on them.

I am using "GET statuses/home_timeline" to do this. The first part of the documentation says it will return the most recent 20 tweets but then says it will return up to 800 and then later on says it will return 200.

Could someone advise me on the correct method to use?

Thanks

EDIT: Documentation link: http://dev.twitter.com/doc/get/statuses/home_timeline

标签: twitter
1条回答
女痞
2楼-- · 2019-04-12 20:51

To get the home timeline (assuming you've already authenticated), you will have to GETthe Home Timeline like follows:

For XML:

http://api.twitter.com/1/statuses/home_timeline.xml

For JSON:

http://api.twitter.com/1/statuses/home_timeline.json

For RSS:

http://api.twitter.com/1/statuses/home_timeline.rss

For ATOM:

http://api.twitter.com/1/statuses/home_timeline.atom

It will return the latest 20 timelines (if no count attribute is passed), but it's maximum return statuses is limited to 800, if retweets are included.

The count attribute only allows you to pull more than 20 (default) statuses but you can request up to 200 maximum statuses (since Twitter has to include retweets).

Does that make sense?

查看更多
登录 后发表回答