本文整理汇总了Java中org.horrabin.horrorss.RssItemBean类的典型用法代码示例。如果您正苦于以下问题:Java RssItemBean类的具体用法?Java RssItemBean怎么用?Java RssItemBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RssItemBean类属于org.horrabin.horrorss包,在下文中一共展示了RssItemBean类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAtomParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testAtomParse(){
this.fileParse("java/test/data/rss-atom.xml");
assertEquals(21,this.items.size());
assertEquals("El blog horroroso de Horrabin", this.channel.getTitle());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
assertEquals("http://horrablog.blogspot.com/2008/07/y-con-este-sencillo-acto.html", item.getLink());
assertEquals("Sun Jul 27 13:50:00 CEST 2008", item.getPubDate().toString());
assertEquals("Horrabin", item.getAuthor());
assertEquals("", this.image.getUrl());
}
示例2: testRSSParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testRSSParse(){
this.fileParse("java/test/data/rss20.xml");
assertEquals(12,this.items.size());
assertEquals("JRMora, humor gráfico", this.channel.getTitle());
RssItemBean item = this.items.get(0);
assertEquals("Activismo de clic", item.getTitle());
item = this.items.get(10);
assertEquals("Meteorito crisis", item.getTitle());
assertEquals("http://feedproxy.google.com/~r/JrmoraHumorGrfico/~3/e_eXwnCTrd4/", item.getLink());
assertEquals("Sun Jan 15 00:52:24 CET 2012", item.getPubDate().toString());
assertEquals("JRMora", item.getAuthor());
assertEquals("http://www.jrmora.com/jr_bocata.jpg", this.image.getUrl());
}
示例3: testRDFParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testRDFParse(){
this.fileParse("java/test/data/rss-rdf.xml");
assertEquals(10,this.items.size());
assertEquals("Barrapunto", this.channel.getTitle());
RssItemBean item = this.items.get(0);
assertEquals("Bloomberg abre su API de datos", item.getTitle());
item = this.items.get(9);
assertEquals("Los mejores inicios de novela", item.getTitle());
assertEquals("http://barrapunto.com/article.pl?sid=12/01/30/216220&from=rss", item.getLink());
assertEquals("Tue Jan 31 00:00:00 CET 2012", item.getPubDate().toString());
assertEquals("Mu", item.getAuthor());
assertEquals("http://barrapunto.com/images/topics/topicbarrapunto.png", this.image.getUrl());
}
示例4: testSimpleGeoModuleParser
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testSimpleGeoModuleParser(){
RssParser rss = new RssParser("java/test/data/georss.xml");
rss.addRssModuleParser("geoRss", new SimpleGeoModuleParser());
RssItemBean item;
RssChannelBean channel;
SimpleGeoRssItemBean geo;
try{
RssFeed obj = rss.load();
channel = obj.getChannel();
List<RssItemBean> items = obj.getItems();
assertEquals("USGS M 5+ Earthquakes", channel.getTitle());
item = items.get(0);
geo = (SimpleGeoRssItemBean)item.getAdditionalInfo("geoRss");
assertEquals("M 5.1, northwestern Iran", item.getTitle());
assertEquals(38.3506, geo.getLatitude());
assertEquals(46.7494, geo.getLongitude());
item = items.get(20);
geo = (SimpleGeoRssItemBean)item.getAdditionalInfo("geoRss");
assertEquals("M 5.2, southern Mid-Atlantic Ridge", item.getTitle());
assertEquals(-33.1277, geo.getLatitude());
assertEquals(-15.8708, geo.getLongitude());
}catch(Exception e){
e.printStackTrace();
}
}
示例5: testUTF8FileParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testUTF8FileParse(){
this.fileParse("java/test/data/rss-utf8.xml", "utf-8");
assertEquals(21,this.items.size());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
assertEquals("Sun Jul 27 13:50:00 CEST 2008", item.getPubDate().toString());
}
示例6: testUTF8URLParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testUTF8URLParse(){
this.fileParse("https://horrorss.googlecode.com/svn/trunk/src/test/data/rss-utf8.xml", "utf-8");
assertEquals(21,this.items.size());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
assertEquals("Sun Jul 27 13:50:00 CEST 2008", item.getPubDate().toString());
}
示例7: testISO88591FileParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testISO88591FileParse(){
this.fileParse("java/test/data/rss-iso-8859-1.xml", "iso-8859-1");
assertEquals(21,this.items.size());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
assertEquals("Sun Jul 27 13:50:00 CEST 2008", item.getPubDate().toString());
}
示例8: testISO88591URLParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testISO88591URLParse(){
this.fileParse("http://horrorss.googlecode.com/svn/trunk/src/test/data/rss-iso-8859-1.xml", "iso-8859-1");
assertEquals(21,this.items.size());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
assertEquals("Sun Jul 27 13:50:00 CEST 2008", item.getPubDate().toString());
}
示例9: testFileParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testFileParse(){
this.fileParse("java/test/data/rss-utf8.xml");
assertEquals(21,this.items.size());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
}
示例10: testURLParse
import org.horrabin.horrorss.RssItemBean; //导入依赖的package包/类
public void testURLParse(){
this.fileParse("http://horrorss.googlecode.com/svn/trunk/src/test/data/rss-utf8.xml");
assertEquals(21,this.items.size());
RssItemBean item = this.items.get(0);
assertEquals("La niñez de Luke Skywalker", item.getTitle());
item = this.items.get(20);
assertEquals("Y con este sencillo acto...", item.getTitle());
}
示例11: 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("gb2312");
rss.setDateParser(new USDateParser());
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();
news.setTitle(item.getTitle());
news.setDescription(item.getDescription());
news.setPubFrom(item.getAuthor());
news.setNewsUrl(item.getLink());
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;
}
示例12: 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;
}
示例13: 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;
}