如何检索超过 200 条推文 [英] How to retrieve more than 200 tweets
问题描述
我想知道如何从 Twitter 页面检索 200 多条推文.我知道它限制为 200,但阅读您可以检索更多,我使用 php 并使用以下代码行获取 200 条推文
I would like to know how to retrieve more than 200 tweets from a twitter page. I know its limited to 200 but read you can retrieve more,Im using php and using this following line of code to get the 200 tweets
$xmldata = 'http://twitter.com/statuses/user_timeline/BBCNews.xml?count=200';
谁能告诉我一些示例代码如何做到这一点?
Could someone show me some example code in how to do this?
谢谢
推荐答案
使用 twitter API,您每页最多只能获得 200 个帖子.您必须添加 &page=x 才能获取推文页面(硬性限制为 3200 个帖子)
With the twitter API you can only get up to 200 posts per page. You would have to add a &page=x to get the page of tweets (there is a hard limit of 3200 posts)
在此处查看 api 文档
View the api documentation here
https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
json api 调用的一个例子是
An example of the api call for json would be
https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitterapi&count=200&page=2
xml 调用的一个例子是
and an example for the xml call would be
https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitterapi&count=200&page=2
所以我的建议是,如果您想获取所有 3200 个帖子,请在函数中设置脚本以每次更改页码
So what i would suggest is if you want to get all 3200 posts is to set up the script in a function to change the page number each time
这篇关于如何检索超过 200 条推文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!