List of usage examples for twitter4j URLEntity getDisplayURL
String getDisplayURL();
From source file:org.getlantern.firetweet.util.TwitterContentUtils.java
License:Open Source License
private static void parseEntities(final HtmlBuilder builder, final EntitySupport entities) { // Format media. final MediaEntity[] mediaEntities = entities.getMediaEntities(); if (mediaEntities != null) { for (final MediaEntity mediaEntity : mediaEntities) { final int start = mediaEntity.getStart(), end = mediaEntity.getEnd(); final String mediaUrl = mediaEntity.getMediaURL(); if (mediaUrl != null && start >= 0 && end >= 0) { builder.addLink(mediaUrl, mediaEntity.getDisplayURL(), start, end); }//www . j av a 2 s.c o m } } final URLEntity[] urlEntities = entities.getURLEntities(); if (urlEntities != null) { for (final URLEntity urlEntity : urlEntities) { final int start = urlEntity.getStart(), end = urlEntity.getEnd(); final String expandedUrl = urlEntity.getExpandedURL(); if (expandedUrl != null && start >= 0 && end >= 0) { builder.addLink(expandedUrl, urlEntity.getDisplayURL(), start, end); } } } }
From source file:org.wandora.application.tools.extractors.twitter.AbstractTwitterExtractor.java
License:Open Source License
public Topic reifyUrlEntity(URLEntity e, TopicMap tm) { Topic entityTopic = null;//from w w w .j ava2 s.co m try { String url = e.getDisplayURL(); if (url != null && url.length() > 0) { if (!url.startsWith("http://")) { url = "http://" + url; } entityTopic = tm.getTopic(url); if (entityTopic == null) { entityTopic = tm.createTopic(); entityTopic.addSubjectIdentifier(new Locator(url)); entityTopic.addType(getURLEntityType(tm)); } } } catch (Exception ec) { log(ec); } return entityTopic; }
From source file:org.xmlsh.twitter.util.TwitterWriter.java
License:BSD License
private void write(URLEntity u) throws XMLStreamException { attribute("display-url", u.getDisplayURL()); attribute("end", u.getEnd()); attribute("expanded-url", u.getExpandedURL().toString()); attribute("start", u.getStart()); attribute("url", u.getURL().toString()); }