Reputation: 26759
We use the following code to read a RSS | ATOM feed, is there a way to find the RSS | ATOM URL of a blog feed give the blog site (e.g. for http://my.typepad.com or http://occupylosangeles.org/
). This should be similar to what google.com/reader does.
import com.sun.syndication.feed.atom.Feed;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.synd.SyndCategory;
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.fetcher.FeedFetcher;
import com.sun.syndication.fetcher.FetcherEvent;
import com.sun.syndication.fetcher.FetcherListener;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
FeedFetcher fetcher = new HttpURLFeedFetcher(feedInfoCache);
// register listener to feed
FetcherEventListenerImpl listener = new FetcherEventListenerImpl();
fetcher.addFetcherEventListener(listener);
// Mechanism to read feeds via Rome Fetcher
SyndFeed feed = fetcher.retrieveFeed(new URL(feedURL));
Upvotes: 3
Views: 870
Reputation: 1484
There seems to be no such feature in ROME, but there's a way. Look for a specific element in HTML source:
<link rel="alternate" type="application/rss+xml" href="http://url-of-an-rss-feed">
rel
and type
values should be exactly like this, and href
will contain the feed's URL.
There's also a way to employ AJAX Feed API by sending a request like this:
http://ajax.googleapis.com/ajax/services/feed/lookup?v=1.0&q=YOUR-PAGE-URL
The source.
Upvotes: 1