我正在使用 Java 的罗马库来解析一些 RSS。默认情况下,它需要 25 个条目。
请告诉我,如何获得接下来的 25 个条目?
我的测试代码是:
public static SyndFeed getSyndFeedForUrl(String url) throws Exception {
SyndFeed feed = null;
InputStream is = null;
try {
URLConnection openConnection = new URL(url).openConnection();
is = new URL(url).openConnection().getInputStream();
if("gzip".equals(openConnection.getContentEncoding())){
is = new GZIPInputStream(is);
}
InputSource source = new InputSource(is);
SyndFeedInput input = new SyndFeedInput();
feed = input.build(source);
} catch (Exception e){
e.printStackTrace();
} finally {
if( is != null) is.close();
}
return feed;
}
public static void main(String[] args) {
SyndFeed feed;
try {
feed = getSyndFeedForUrl("http://example.com/rss");
List res = feed.getEntries();
for(Object o : res) {
System.out.println(((SyndEntryImpl) o).getDescription().getValue());
}
} catch (Exception e) {
e.printStackTrace();
}
}
谢谢!