获取公共Twitter个人资料的鸣叫 [英] Get tweets of a public twitter profile
问题描述
我在Twitter的个人资料是公开的用户名列表。我希望得到所有的鸣叫,他们已经从他们形成了自己的个人资料之日公布。我查了Twitter4J的例子在<一个href=\"https://github.com/yusuke/twitter4j/blob/master/twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetUserTimeline.java\"相对=nofollow> GitHub上。
根据Twitter的API文档,只有20个最新的鸣叫返回。反正我有可以执行我的任务?
I have a list of usernames on Twitter whose profiles are public. I wish to get "all the tweets" they have posted from the day they formed their profile. I checked Twitter4J examples on GitHub.
According to the Twitter API documentation, only the 20 most recent tweets are returned. Is there anyway I could perform my task?
推荐答案
要使用Twitter4J获取某个用户的所有帖子,你将不得不作出在多个页面您的要求。
To use Twitter4J to get all posts from a user you'll have to make your request over multiple pages..
下面code基于为例on GitHub的
Below code based of an example on GitHub
Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
//First param of Paging() is the page number, second is the number per page (this is capped around 200 I think.
Paging paging = new Paging(1, 100);
List<Status> statuses = unauthenticatedTwitter.getUserTimeline("google",paging);
只是循环,并保持抓住新的页面,直到没有新的职位应该工作。
Just loop and keep grabbing new pages until there are no new posts should work.
这篇关于获取公共Twitter个人资料的鸣叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!