本文整理汇总了Java中org.horrabin.horrorss.RssItemBean.getDescription方法的典型用法代码示例。如果您正苦于以下问题:Java RssItemBean.getDescription方法的具体用法?Java RssItemBean.getDescription怎么用?Java RssItemBean.getDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.horrabin.horrorss.RssItemBean
的用法示例。
在下文中一共展示了RssItemBean.getDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseWaitTimeDescription
import org.horrabin.horrorss.RssItemBean; //导入方法依赖的package包/类
private static String parseWaitTimeDescription( RssItemBean rssItemBean ) {
String description = rssItemBean.getDescription();
description = description.split( ", " )[1];
description = description.split( " " )[0] + " " + description.split( " " )[1];
return description;
}
示例2: parse
import org.horrabin.horrorss.RssItemBean; //导入方法依赖的package包/类
@Override
public List<News> parse(String str) {
Date now = new Date();
List<News> list = Lists.newArrayList();
RssParser rss = new RssParser();
rss.setCharset("utf-8");
rss.setDateParser(new USDateParser());
// rss.setProxy("63.223.64.119", 3128);
try{
RssFeed feed = null;
feed = rss.load(str);
// Gets and iterate the items of the feed
List<RssItemBean> items = feed.getItems();
for(RssItemBean item : items) {
News news = new News();
// Title - From
String title = item.getTitle();
int sepIdx = title.indexOf("-");
if(sepIdx == -1)
news.setTitle(title);
else {
news.setTitle(title.substring(0,sepIdx).trim());
news.setPubFrom(title.substring(sepIdx + 1).trim());
}
// link
String link = item.getLink();
sepIdx = link.indexOf("url=");
if(sepIdx == -1) {
news.setNewsUrl(link);
} else {
news.setNewsUrl(link.substring(sepIdx + "url=".length()).trim());
}
// desc
String desc = item.getDescription();
desc = Jsoup.parse(desc).text();
desc = StringUtils.replaceOnce(desc, title, "");
if(news.getPubFrom().length() > 0)
desc = StringUtils.replaceOnce(desc, news.getPubFrom(), "");
sepIdx = desc.indexOf("...");
if(sepIdx != -1) {
desc = desc.substring(0, sepIdx).trim();
}
news.setDescription(desc);
// publish time
news.setDateTime(item.getPubDate().getTime());
long timeDiff = now.getTime() - item.getPubDate().getTime();
if(timeDiff <= Constants.MSEC_PER_DAY)
list.add(news);
}
}catch(Exception e){
e.printStackTrace();
}
return list;
}