List of usage examples for twitter4j HashtagEntity getStart
@Override
int getStart();
From source file:com.github.daytron.twaattin.ui.tabledecorator.TweetColumnDecorator.java
License:Open Source License
void createFragmentsWithTag(HashtagEntity[] tags) { if (tags != null) { for (HashtagEntity tag : tags) { int start = tag.getStart(); int end = tag.getEnd(); try { String encodedUrl = TWITTER_SEARCH_URL + URLEncoder.encode('#' + tag.getText(), "UTF-8"); String href = "<a href='" + encodedUrl + "' target='search'>"; TweetFragment fragment = new TweetFragment(start, end, href + '#' + tag.getText() + "</a>"); fragments.add(fragment); } catch (UnsupportedEncodingException e) { e.printStackTrace();//from ww w . j ava2s .c o m } } } }
From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java
License:Apache License
static Struct convertHashtagEntity(HashtagEntity hashtagEntity) { return new Struct(SCHEMA_HASHTAG_ENTITY).put("Text", hashtagEntity.getText()) .put("Start", hashtagEntity.getStart()).put("End", hashtagEntity.getEnd()); }
From source file:com.mothsoft.alexis.engine.retrieval.TwitterRetrievalTaskImpl.java
License:Apache License
private List<TweetHashtag> readHashtags(Status status) { final List<TweetHashtag> hashtags = new ArrayList<TweetHashtag>(); if (status.getHashtagEntities() != null) { for (final HashtagEntity entity : status.getHashtagEntities()) { final TweetHashtag hashtag = new TweetHashtag((short) entity.getStart(), (short) entity.getEnd(), entity.getText());/* w w w. j ava2 s .c o m*/ hashtags.add(hashtag); } } return hashtags; }
From source file:org.xmlsh.twitter.util.TwitterWriter.java
License:BSD License
private void write(String localName, HashtagEntity e) throws XMLStreamException { startElement(localName);/*from w w w.j a va 2s . co m*/ attribute("start", e.getStart()); attribute("end", e.getEnd()); characters(e.getText()); endElement(); }