简体   繁体   English

获取罗马图书馆的所有RSS feed条目

[英]Get all RSS feed entries with Rome Library

i am using Rome library for Java to parse some RSS. 我正在使用Java的Rome库来解析一些RSS。 By default it takes 25 entries. 默认情况下,它需要25个条目。

Tell me please, how to get next 25 entries? 请告诉我,如何获得下25个条目?

My test code is: 我的测试代码是:

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();
        }
    }

Thank you! 谢谢!

When you call feed.getEntries() , Rome library returns all entries that are available in http://example.com/rss . 当您调用feed.getEntries() ,罗马库将返回http://example.com/rss中可用的所有条目。 It is not possible to get more than there are in the xml document (unless the entries have been cached in some service like Feedly). 不可能获得比xml文档更多的信息(除非条目已缓存在某些服务(例如Feedly)中)。

See 看到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM