本文整理汇总了Java中com.rometools.rome.feed.synd.SyndEntry.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Java SyndEntry.getTitle方法的具体用法?Java SyndEntry.getTitle怎么用?Java SyndEntry.getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.synd.SyndEntry
的用法示例。
在下文中一共展示了SyndEntry.getTitle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearchResults
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
public static SearchResultsCursor getSearchResults(final String query) {
final List<Integer> positions = new ArrayList<>();
final List<LinkedHashMap<Integer, Integer>> indicesTitle = new ArrayList<>();
int i = 1;
for (final SyndEntry entry : sCurrentFeed.getEntries()) {
final String title = entry.getTitle();
if (StringUtils.containsIgnoreCase(title, query)) {
indicesTitle.add(SearchUtils.getIndicesForQuery(title, query));
positions.add(i);
}
i++;
}
return new SearchResultsCursor(positions, indicesTitle);
}
示例2: asContent
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
public String asContent(Map<String, Object> dataMap) {
SyndEntry entry = getSource().getEntries().stream().findFirst().orElse(null);
if (entry != null) {
return entry.getTitle() + " " + formatRelative(entry.getPublishedDate().toInstant());
}
return getSource().getTitle() + " " + formatRelative(Instant.ofEpochMilli(getTimestamp()));
}
示例3: reload
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private void reload() {
// System.out.println(feed);
if (!incidents.isEmpty()) incidents.clear();
for (SyndEntry entry : feed.getEntries()) {
ServerStatusIncident incident = new ServerStatusIncident(entry.getTitle(), entry.getLink(), entry.getContents().get(0).getValue());
if ((incident.contains(game) && incident.contains(platform)))
incidents.add(incident);
}
}
示例4: ExtLibOPDSEntry
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
public ExtLibOPDSEntry(SyndEntry syndEntry) {
id = syndEntry.getUri();
title = new Res("opds.first.value",syndEntry.getTitle());
links = syndEntry.getLinks().stream().
map(ExtLibOPDSEntry::mapLink).filter(Objects::nonNull).collect(Collectors.toList());
updated = syndEntry.getUpdatedDate();
content = Optional.of(syndEntry.getContents().stream().
map(sc -> new OPDSContent(sc.getType(), sc.getValue(), null)).collect(Collectors.toList()));
List<OPDSAuthor> authors = syndEntry.getAuthors().stream().
map(person -> new ExtLibAuthor(person.getName(), "")).collect(Collectors.toList());
this.authors = Optional.of(authors);
}
示例5: getTitle
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private String getTitle(SyndEntry item) {
String title = item.getTitle();
if (StringUtils.isBlank(title)) {
Date date = item.getPublishedDate();
if (date != null) {
title = DateFormat.getInstance().format(date);
} else {
title = "(no title)";
}
}
return StringUtils.trimToNull(title);
}
示例6: parseFeed
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private List<Outlink> parseFeed(String url, byte[] content,
Metadata parentMetadata) throws Exception {
List<Outlink> links = new ArrayList<>();
SyndFeed feed = null;
try (ByteArrayInputStream is = new ByteArrayInputStream(content)) {
SyndFeedInput input = new SyndFeedInput();
feed = input.build(new InputSource(is));
}
URL sURL = new URL(url);
List<SyndEntry> entries = feed.getEntries();
for (SyndEntry entry : entries) {
String targetURL = entry.getLink();
// targetURL can be null?!?
// e.g. feed does not use links but guid
if (StringUtils.isBlank(targetURL)) {
targetURL = entry.getUri();
if (StringUtils.isBlank(targetURL)) {
continue;
}
}
Outlink newLink = filterOutlink(sURL, targetURL, parentMetadata);
if (newLink == null)
continue;
String title = entry.getTitle();
if (StringUtils.isNotBlank(title)) {
newLink.getMetadata().setValue("feed.title", title.trim());
}
Date publishedDate = entry.getPublishedDate();
if (publishedDate != null) {
// filter based on the published date
if (filterHoursSincePub != -1) {
Calendar rightNow = Calendar.getInstance();
rightNow.add(Calendar.HOUR, -filterHoursSincePub);
if (publishedDate.before(rightNow.getTime())) {
LOG.info(
"{} has a published date {} which is more than {} hours old",
targetURL, publishedDate.toString(),
filterHoursSincePub);
continue;
}
}
newLink.getMetadata().setValue("feed.publishedDate",
publishedDate.toString());
}
SyndContent description = entry.getDescription();
if (description != null
&& StringUtils.isNotBlank(description.getValue())) {
newLink.getMetadata().setValue("feed.description",
description.getValue());
}
links.add(newLink);
}
return links;
}
示例7: nextTuple
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
public void nextTuple() {
// Fetch feeds only every 30 secs.
long curtime = System.currentTimeMillis();
if (this.lastFetchTimestamp != 0) {
if (curtime - this.lastFetchTimestamp < 30000) {
// A Spout's nextTuple() is called continuously in a loop by Storm. If there's nothing to do,
// just exit the method so Storm can do other things like acking processed messages.
return;
}
}
LOG.info("Fetching comments for " + subreddit + " at " + curtime);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = null;
try {
feed = input.build(new XmlReader(this.subredditCommentsfeedURL));
} catch (Exception e) {
throw new RuntimeException(e);
}
this.lastFetchTimestamp = System.currentTimeMillis();
LOG.info("Fetched " + feed.getEntries().size() + " comments for " + subreddit + " at " + this.lastFetchTimestamp);
history.startBatch();
for (SyndEntry s : feed.getEntries()) {
String commentId = s.getUri();
if (history.contains(commentId)) {
LOG.info("Skip dupe " + subreddit + ":" + commentId);
continue;
}
// An entry.link has the syntax:
// /r/[SUBREDDIT]/comments/[STORY-ID]/[STORY-PATH]/[COMMENT-ID]
// We extract the story ID and story URL (that is everything except the [COMMENT-ID] at the end.
//
// Story title can be extracted from entry.title which has the syntax:
// [AUTHOR] on [STORY TITLE]
List<SyndContent> contents = s.getContents();
if (contents != null && contents.size() > 0) {
String link = s.getLink();
String storyURL = link.substring(0, link.lastIndexOf("/"));
String[] parts = storyURL.split("/");
String storyId = parts[4];
String title = s.getTitle();
String titlePrefix = s.getAuthor() + " on ";
String storyTitle = title.substring(titlePrefix.length(), title.length());
SyndContent cnt = contents.get(0);
String comment = cnt.getValue();
comment = Jsoup.clean(comment, Whitelist.none());
comment = comment.replaceAll("\\p{Punct}", "");
LOG.info("Emit {}:{}:{}:{}:{}:[{}]", subreddit, storyId, storyURL, storyTitle, commentId, comment);
collector.emit(
new Values(subreddit, storyId, storyURL, storyTitle, commentId, comment, this.lastFetchTimestamp),
commentId);
}
history.add(commentId);
}
}
示例8: getEntryTitle
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
public String getEntryTitle(final Object o) throws Exception {
final SyndEntry e = (SyndEntry) o;
return e.getTitle();
}
示例9: formatNewsString
import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
* Formate un message contenant des informations contenu dans l'entrée donnée
* @param entry l'entrée dont on doit récupérer les info
* @return un message formaté contenant
*/
private String formatNewsString(SyndEntry news)
{
return "Titre : " + news.getTitle() + "\nLien : " + news.getLink();
}