简体   繁体   English

Ruby on Rails Twitter gem,分页结果

[英]Ruby on rails Twitter gem, paging results

I stumbled over this one: When you get a home_timeline, twitter API normally returns the first 20 tweets. 我偶然发现了这一点:当您获得home_timeline时,twitter API通常会返回前20条推文。 I wanted to get the first 200 which is allowed by the API, but couldn't find how to do it. 我想获得API允许的前200个,但是找不到如何做。 In Java it works like this: 在Java中,它的工作方式如下:

Paging paging = new Paging(1);// always get first page of tweets
paging.setCount(200);// set count of tweets to get from timeline
List<Status> statuses = null;

// get newsfeed from twitter
statuses = twitter.getHomeTimeline(paging);

答案如下:

@tweetCollection = TwitterClient.home_timeline(:page => 1, :count => 200)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM