2012-02-27 2 views
3

다음 코드를 사용하여 RSS를 읽습니다. Atom 피드, RSS를 찾는 방법이 있습니까 | 블로그 피드의 ATOM URL (예 : for http://my.typepad.com or http://occupylosangeles.org/). 이는 google.com/reader의 기능과 유사해야합니다.블로그 사이트에서 프로그래밍 방식으로 블로그 피드 URL을 찾는 방법

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

답변

1

ROME에는 이러한 기능이없는 것으로 보이지만 방법이 있습니다. HTML 소스의 특정 요소를 찾아 :

<link rel="alternate" type="application/rss+xml" href="http://url-of-an-rss-feed"> 

reltype 값은 정확히 다음과 같이해야하고, href 피드의 URL이 포함됩니다.

이 같은 요청을 전송하여 AJAX Feed API을 사용하는 방법도 있습니다 :

http://ajax.googleapis.com/ajax/services/feed/lookup?v=1.0&q=YOUR-PAGE-URL 

source.

+0

이 서비스를 사용하려면 등록 된 응용 프로그램 키가 필요합니까? 아니면 완전히 무료입니까? 또한'number of requests'count에 대한 세부 정보를 찾을 수 없습니다. API가 폐지 되었습니까? –

관련 문제