本文整理了Java中twitter4j.Twitter.getHomeTimeline()
方法的一些代码示例,展示了Twitter.getHomeTimeline()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Twitter.getHomeTimeline()
方法的具体详情如下:
包路径:twitter4j.Twitter
类名称:Twitter
方法名:getHomeTimeline
[英]Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
This method calls http://twitter.com/statuses/home_timeline
[中]返回验证用户及其好友发布的20个最新状态,包括转发。这相当于Web上的/timeline/home。
此方法调用http://twitter.com/statuses/home_timeline
代码示例来源:origin: org.apache.camel/camel-twitter
@Override
protected List<Status> doDirect() throws TwitterException {
log.trace("doDirect.getHomeTimeline()");
return getTwitter().getHomeTimeline();
}
}
代码示例来源:origin: Apress/beg-spring-boot-2
@Override
public void run(String... arg0) throws Exception {
ResponseList<Status> homeTimeline = twitter.getHomeTimeline();
for (Status status : homeTimeline) {
System.err.println(status.getText());
}
}
代码示例来源:origin: Tristan971/Lyrebird
@Override
protected List<Status> backfillLoad(final Twitter twitter, final Paging paging) throws TwitterException {
return twitter.getHomeTimeline(paging)
.stream()
.filter(((Predicate<Status>) interactionService::isRetweetByCurrentUser).negate())
.collect(Collectors.toList());
}
代码示例来源:origin: Tristan971/Lyrebird
@Override
protected List<Status> initialLoad(final Twitter twitter) throws TwitterException {
return twitter.getHomeTimeline()
.stream()
.filter(((Predicate<Status>) interactionService::isRetweetByCurrentUser).negate())
.collect(Collectors.toList());
}
代码示例来源:origin: Apress/beg-spring-boot-2
public List<String> getLatestTweets()
{
List<String> tweets = new ArrayList<>();
try {
ResponseList<Status> homeTimeline = twitter.getHomeTimeline();
for (Status status : homeTimeline)
{
tweets.add(status.getText());
}
}
catch (TwitterException e) {
throw new RuntimeException(e);
}
return tweets;
}
}
代码示例来源:origin: stackoverflow.com
Twitter twitter = TwitterFactory.getSingleton();
List<Status> statuses = twitter.getHomeTimeline();
System.out.println("Showing home timeline.");
for (Status status : statuses) {
System.out.println(status.getUser().getName() + ":" +
status.getText());
}
代码示例来源:origin: stackoverflow.com
Twitter twitter = TwitterFactory.getSingleton();
List<Status> statuses = twitter.getHomeTimeline();
System.out.println("Showing home timeline.");
for (Status status : statuses) {
System.out.println(status.getUser().getName() + ":" +
status.getText());
}
代码示例来源:origin: stackoverflow.com
Twitter twitter = TwitterFactory.getSingleton();
List<Status> statuses = twitter.getHomeTimeline();
System.out.println("Showing home timeline.");
for (Status status : statuses) {
System.out.println(status.getUser().getName() + ":" + status.getText());
}
代码示例来源:origin: stackoverflow.com
Twitter twitter = TwitterFactory.getSingleton();
List<Status> statuses = twitter.getHomeTimeline();
System.out.println("Showing home timeline.");
for (Status status : statuses) {
System.out.println(status.getUser().getName() + ":" +
status.getText());
}
代码示例来源:origin: org.twitter4j/twitter4j-async
@Override
public void invoke(List<TwitterListener> listeners) throws TwitterException {
ResponseList<Status> statuses = twitter.getHomeTimeline();
for (TwitterListener listener : listeners) {
try {
listener.gotHomeTimeline(statuses);
} catch (Exception e) {
logger.warn("Exception at getHomeTimeline", e);
}
}
}
});
代码示例来源:origin: org.twitter4j/twitter4j-async
@Override
public void invoke(List<TwitterListener> listeners) throws TwitterException {
ResponseList<Status> statuses = twitter.getHomeTimeline(paging);
for (TwitterListener listener : listeners) {
try {
listener.gotHomeTimeline(statuses);
} catch (Exception e) {
logger.warn("Exception at getHomeTimeline", e);
}
}
}
});
代码示例来源:origin: org.apache.camel/camel-twitter
@Override
protected List<Status> doPoll() throws TwitterException {
Paging paging = getLastIdPaging();
log.trace("doPoll.getHomeTimeline(sinceId={})", paging.getSinceId());
return getTwitter().getHomeTimeline(paging);
}
代码示例来源:origin: stackoverflow.com
try {
List<Status> statuses;
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(consumerKeyStr, consumerSecretStr);
AccessToken accessToken = new AccessToken(accessTokenStr,
accessTokenSecretStr);
twitter.setOAuthAccessToken(accessToken);
statuses = twitter.getHomeTimeline();
System.out.println("Showing Home timeline :");
for (Status status : statuses) {
System.out.println(status.getUser().getScreenName() + " : " + status.getText());
}
} catch (TwitterException te) {
te.printStackTrace();
}
代码示例来源:origin: stackoverflow.com
ResponseList list = twitter.getHomeTimeline();
for (Status each : list) {
代码示例来源:origin: stackoverflow.com
ConfigurationBuilder builder = new ConfigurationBuilder();
// GET THE CONSUMER KEY AND SECRET KEY FROM THE STRINGS XML
String TWITTER_CONSUMER_KEY = getString(R.string.TWITTER_CONSUMER_KEY);
String TWITTER_CONSUMER_SECRET = getString(R.string.TWITTER_CONSUMER_SECRET);
// TWITTER ACCESS TOKEN
String twit_access_token = twitPrefs.getString(PREF_KEY_OAUTH_TOKEN, "");
// TWITTER ACCESS TOKEN SECRET
String twit_access_token_secret = twitPrefs.getString(PREF_KEY_OAUTH_SECRET, "");
builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
builder.setOAuthAccessToken(twit_access_token);
builder.setOAuthAccessTokenSecret(twit_access_token_secret);
AccessToken accessToken = new AccessToken(twit_access_token, twit_access_token_secret);
Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken);
Paging paging = new Paging(1, 20);
statuses = twitter.getHomeTimeline(paging);
// NOW LOOP THROUGH THE statuses AND FETCH INDIVIDUAL DETAILS
for (int i = 0; i < statuses.size(); i++) {
String strTweetID = String.valueOf(statuses.get(i).getId());
.... REST OF WHATEVER YOU NEED TO PULL OUT OF THE
}
代码示例来源:origin: stackoverflow.com
statuses = twitter.getHomeTimeline(paging);
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.setDebugEnabled(true);
configurationBuilder.setOAuthConsumerKey(YOURCONSUMER_KEY);
configurationBuilder.setOAuthConsumerSecret(YOURCONSUMER_SECRET);
configurationBuilder.setOAuthAccessToken(YOURACCESSTOKEN);
configurationBuilder.setOAuthAccessTokenSecret(YOURTOKENSECRET);
configurationBuilder.setUseSSL(true);
Configuration configuration = configurationBuilder.build();
Twitter twitter = new TwitterFactory(configuration).getInstance();
try {
ResponseList<Status> a = twitter.getHomeTimeline(new Paging(1, 5));
for (Status b : a) {
System.out.println(b.getText());
}
} catch (Exception e) {
System.out.println(e);
}
}
代码示例来源:origin: org.mule.modules/mule-module-twitter
@Placement(group = "Pagination") @Default(value = "-1") long sinceId)
throws TwitterException {
return getConnectionManagement().getTwitterClient().getHomeTimeline(getPaging(page, count, sinceId));
内容来源于网络,如有侵权,请联系作者删除!