public static SusiThought readRSS(String url) { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null;
System.setProperty("http.agent", USER_AGENT); URLConnection openConnection = url.openConnection(); is = url.openConnection().getInputStream(); if ("gzip".equals(openConnection.getContentEncoding())) { is = new GZIPInputStream(is); } InputSource source = new InputSource(is); input = new SyndFeedInput(); syndicationFeed = input.build(source); XmlReader reader = new XmlReader(url); syndicationFeed = input.build(reader);
public void run() { try { feed = new SyndFeedInput().build(new InputStreamReader(new ByteArrayInputStream(feedContents.getBytes()))); } catch (FeedException e) { log.warn("Cannot parse remote feed contents from:\n" + feedContents, e); } } }
URL feedSource = new URL("http://...."); feed = new SyndFeedInput().build(new XmlReader(feedSource)); List<SyndEntryImpl> entries = (List<SyndEntryImpl>)feed.getEntries(); for(SyndEntryImpl entry : entries){ System.out.println(entry.getDescription().getValue()); }
HttpClient httpClient = new DefaultHttpClient(); HttpGet pageGet = new HttpGet(feedUrl.toURI()); HttpResponse response = httpClient.execute(pageGet); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(response.getEntity().getContent()));
try { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(file)); } catch(Exception e) { Log.e("", "ROME parse error: " + e.toString()); } catch(Error e2) { Log.e("", "ROME parse error2: " + e2.toString()); }
HttpURLConnection connection = (HttpURLConnection)url.openConnection(); InputStream is = connection.getInputStream(); InputSource source = new InputSource(is); SyndFeedInput input = new SyndFeedInput(); feed = input.build(source);
// create a Document from inputstream is DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(is); // fetch the feed SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(doc);
public static SyndFeed createFeed(String feedUri, ClassLoader classLoader) throws Exception { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classLoader); InputStream in = new URL(feedUri).openStream(); SyndFeedInput input = new SyndFeedInput(); return input.build(new XmlReader(in)); } finally { Thread.currentThread().setContextClassLoader(tccl); } }
public boolean romeLibraryExample(String address) { boolean ok = false; try{ URL url = new URL(address); HttpURLConnection httpcon = (HttpURLConnection)url.openConnection(); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(url)); ok = true; } catch (Exception exc){ exc.printStackTrace(); } return ok; }
public boolean tryFeed(String feedUrl) throws IOException,MalformedURLException { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; try { feed = input.build(new XmlReader(new URL(feedUrl))); return true; } catch (FeedException e) { // Feed's invalid return false; } }
public static SyndFeed createFeed(String feedUri, ClassLoader classLoader) throws Exception { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classLoader); URL feedUrl = new URL(feedUri); HttpURLConnection httpcon = (HttpURLConnection)feedUrl.openConnection(); String encoding = new sun.misc.BASE64Encoder().encode("username:password".getBytes()); httpcon.setRequestProperty ("Authorization", "Basic " + encoding); SyndFeedInput input = new SyndFeedInput(); return input.build(new XmlReader(httpcon)); } finally { Thread.currentThread().setContextClassLoader(tccl); } }
URL feedUrl = new URL("http://the.url.to/the/feed"); //URL feedUrl = new URL("http://user:pass@the.url.to/the/feed"); HttpURLConnection connection = (HttpURLConnection) feedUrl.openConnection(); if (feedUrl.getUserInfo() != null) { String encoding = new sun.misc.BASE64Encoder().encode(feedUrl.getUserInfo().getBytes()); connection.setRequestProperty("Authorization", "Basic " + encoding); } SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(connection));
SyndFeedInput fr = new SyndFeedInput(); SyndFeed sf = fr.build(new XmlReader(myInputStream)); List<?> entries = sf.getEntries();
private static FeedResponse validate(String feedRequestUrl) { try { URL url = new URL(feedRequestUrl); SyndFeedInput input = new SyndFeedInput(); input.build(new XmlReader(url)); //ensure request is a valid rss feed return FeedResponse.valid(feedRequestUrl); } catch (Exception e) { logger.debug("could not parse feed request {}, reason {}", feedRequestUrl, e.getMessage()); return FeedResponse.invalid(e.getMessage(), feedRequestUrl); } }
URL feedUrl = new URL(feed) HttpURLConnection httpcon = (HttpURLConnection)feedUrl.openConnection(); String encoding = new sun.misc.BASE64Encoder().encode("username:password".getBytes()); httpcon.setRequestProperty ("Authorization", "Basic " + encoding); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(httpcon));
URL feedUrl = new URL("http://www.bloomberg.com/tvradio/podcast/cat_markets.xml"); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(feedUrl)); for (Iterator i = feed.getEntries().iterator(); i.hasNext();) { SyndEntry entry = (SyndEntry) i.next(); System.out.println("title |"+entry.getTitle()+" " -timeStamp "+entry.getPublishedDate()"\n") }
URL url = new URL("http://feeds.feedburner.com/javatipsfeed"); XmlReader reader = null; try { reader = new XmlReader(url); SyndFeed feeder = new SyndFeedInput().build(reader); System.out.println("Feed Title: "+ feeder.getAuthor()); for (Iterator i = feeder.getEntries().iterator(); i.hasNext();) { SyndEntry syndEntry = (SyndEntry) i.next(); System.out.println(syndEntry.getTitle()); } } finally { if (reader != null) reader.close(); }
public static RufusFeed generate(Source source) { SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; URL url = source.getUrl(); try { feed = input.build(new XmlReader(url)); } catch (Exception e) { logger.debug("Could not build SyndFeedInput for {}", url, e); } if (CollectionUtils.isEmpty(source.getTags())) { source.setTags(Collections.emptyList()); //never null! } return new RufusFeed(source, feed); }
public static SyndFeed getFeed( String feedId ) throws IllegalArgumentException, MalformedURLException, FeedException, IOException { SyndFeedInput input = new SyndFeedInput(); Response response = RequestFacade.sendMessage( FEED_URL_PART + feedId, Method.GET ); Assert.assertTrue( "Expected content", response.getEntity().isAvailable()); SyndFeed feed = input.build( new XmlReader( response.getEntity().getStream() ) ); // sort it by date sortSyndEntryOrderByPublishedDate( feed ); return feed; }