本文整理了Java中twitter4j.Status.getText()
方法的一些代码示例,展示了Status.getText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getText()
方法的具体详情如下:
包路径:twitter4j.Status
类名称:Status
方法名:getText
[英]Returns the text of the status
[中]返回状态的文本
代码示例来源:origin: apache/incubator-druid
String text = status.getText();
theMap.put("text", (null == text) ? "" : text);
theMap.put(
代码示例来源:origin: google/data-transfer-project
"Twitter Photo " + mediaEntity.getId(),
mediaEntity.getMediaURL(),
status.getText(),
null,
Long.toString(status.getId()),
代码示例来源:origin: apache/flume
private Record extractRecord(String idPrefix, Schema avroSchema, Status status) {
User user = status.getUser();
Record doc = new Record(avroSchema);
doc.put("id", idPrefix + status.getId());
doc.put("created_at", formatterTo.format(status.getCreatedAt()));
doc.put("retweet_count", status.getRetweetCount());
doc.put("retweeted", status.isRetweet());
doc.put("in_reply_to_user_id", status.getInReplyToUserId());
doc.put("in_reply_to_status_id", status.getInReplyToStatusId());
addString(doc, "source", status.getSource());
addString(doc, "text", status.getText());
MediaEntity[] mediaEntities = status.getMediaEntities();
if (mediaEntities.length > 0) {
addString(doc, "media_url_https", mediaEntities[0].getMediaURLHttps());
addString(doc, "expanded_url", mediaEntities[0].getExpandedURL());
}
doc.put("user_friends_count", user.getFriendsCount());
doc.put("user_statuses_count", user.getStatusesCount());
doc.put("user_followers_count", user.getFollowersCount());
addString(doc, "user_location", user.getLocation());
addString(doc, "user_description", user.getDescription());
addString(doc, "user_screen_name", user.getScreenName());
addString(doc, "user_name", user.getName());
return doc;
}
代码示例来源:origin: stackoverflow.com
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("B***************Q")
.setOAuthConsumerSecret(
"l*********************************o")
.setOAuthAccessToken(
"1*******************************X")
.setOAuthAccessTokenSecret(
"1***************************c");
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
try {
List<Status> statuses;
String user;
user = "replace with the user name of your choice";
statuses = twitter.getUserTimeline(user);
Log.i("Status Count", statuses.size() + " Feeds");
for (int i = 0; i < statuses.size(); i++) {
Status status = statuses.get(i);
Log.i("Tweet Count " + (i + 1), status.getText() + "\n\n");
}
} catch (TwitterException te) {
te.printStackTrace();
}
代码示例来源:origin: pulsarIO/realtime-analytics
@Override
public void onStatus(Status status) {
HashtagEntity[] hashtagEntities = status.getHashtagEntities();
JetstreamEvent event = new JetstreamEvent();
event.setEventType("TwitterSample");
Place place = status.getPlace();
if (place != null) {
event.put("country", place.getCountry());
}
event.put("ct", status.getCreatedAt().getTime());
event.put("text", status.getText());
event.put("lang", status.getLang());
event.put("user", status.getUser().getName());
if (hashtagEntities != null && hashtagEntities.length > 0) {
StringBuilder s = new StringBuilder();
s.append(hashtagEntities[0].getText());
for (int i = 1; i < hashtagEntities.length; i++) {
s.append(",");
s.append(hashtagEntities[i].getText());
}
event.put("hashtag", s.toString());
}
fireSendEvent(event);
}
代码示例来源:origin: stackoverflow.com
import static org.mockito.Mockito.mock;
// ...
public void testCode() {
// given - we'll mock a Status which returns a canned result:
Status status = mock(Status.class);
when(status.getText()).thenReturn("It's a nice summer day!");
// when - exercise your class
String statusText = YourClass.extractStatusText(status);
// then - check that the status text is returned
assertEquals("It's a nice summer day!", statusText);
}
代码示例来源:origin: org.tomitribe/chatterbox-twitter-impl
private static String getNormalizedText(Status status) {
String text = status.getText();
while (text.startsWith("@")) {
text = text.replaceFirst("@?(\\w){1,15}(\\s+)","");
}
return text;
}
代码示例来源:origin: net.homeip.yusuke/twitter4j
@Override public void updated(Status status) {
System.out.println("Successfully updated the status to [" +
status.getText() + "].");
synchronized (lock) {
lock.notify();
}
}
代码示例来源:origin: stackoverflow.com
List<Map<String, String>> tweetList = new LinkedList<Map<String, String>>();
for (Status tweet : tweets) {
Map<String, String> tweetResult = new LinkedHashMap<String, String>();
tweetResult.put("username", tweet.getUser().getScreenName());
tweetResult.put("status", tweet.getText());
tweetResult.put("date", tweet.getCreatedAt().toString());
tweetResult.put("retweets", String.valueOf(tweet.getRetweetCount()));
tweetList.add(tweetResult);
}
String resultJson = new Gson().toJson(tweetList);
response.getWriter().write(resultJson);
代码示例来源:origin: borax12/Searcher
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if(tweets!=null&&!tweets.isEmpty()){
Status tweet = tweets.get(position);
holder.handle.setText("@"+tweet.getUser().getScreenName());
holder.tweet.setText(tweet.getText());
DateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy");
holder.timeStamp.setText(dateFormat.format(tweet.getCreatedAt()));
}
}
代码示例来源:origin: stackoverflow.com
Twitter twitter = new TwitterFactory().getInstance();
List<Status> statuses = twitter.getFriendsTimeline();
System.out.println("Showing friends 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: tdunning/MiA
public void onStatus(Status status) {
String username = status.getUser().getScreenName();
String text = status.getText().replace('\n', ' ');
out.println(username + "\t" + text);
System.out.println(username + "\t" + text);
count++;
if(count >= maxCount) {
tweetStream.shutdown();
out.close();
}
}
代码示例来源:origin: org.apache.camel/camel-twitter
@Converter
public static String toString(Status status) throws ParseException {
return new StringBuilder()
.append(status.getCreatedAt()).append(" (").append(status.getUser().getScreenName()).append(") ")
.append(status.getText())
.toString();
}
代码示例来源:origin: stackoverflow.com
ResponseList<Status> list = twitter.getHomeTimeline();
for (Status each : list) {
System.out.println("Sent by: @" + each.getUser().getScreenName() + " - " + each.getUser().getName() + "\n"
+ each.getText() + "\n");
}
代码示例来源:origin: stackoverflow.com
QueryResult result = twitter.search(new Query("Some term"));
for (Status status : result.getTweets())
{
System.out.println(status.getText());
System.out.println(status.getFavoriteCount());
System.out.println(status.isFavorited());
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Autowired
public Foo(Observable<Status> tweets) {
tweets.subscribe(status -> {
log.info(status.getText());
});
log.info("Subscribed");
}
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Autowired
public Bar(Observable<Status> tweets) {
tweets.subscribe(status -> {
log.info(status.getText());
});
log.info("Subscribed");
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
private String processTweet(Status status) {
String tweet = status.getText();
for (URLEntity entity : status.getURLEntities()) {
String url = String.format("<a target=\"_blank\" href=\"%s\">%s</a>", entity.getURL(), entity.getURL());
tweet = tweet.replace(entity.getURL(), url);
}
return tweet;
}
代码示例来源:origin: stackoverflow.com
Twitter tw = new TwitterFactory().getInstance();
// some userlist
UserList userList = tw.getUserLists("screen name", -1).get(0);
System.out.println(userList.getName());
int listId = userList.getId();
ResponseList<Status> userListStatuses = tw.getUserListStatuses(listId, new Paging(1));
for (Status status : userListStatuses) {
System.out.println(status.getText());
}
内容来源于网络,如有侵权,请联系作者删除!