我正在尝试使用Rome1.0和Java访问播客机箱中的.mp3链接。机箱包含类型,URL和长度。我找不到任何文件。 Java.net上的wiki已被删除。
public static void main(String[] args) throws IOException, IllegalArgumentException, FeedException
{
URL url = new URL("http://www.theskepticsguide.org/feed/rss.aspx? feed=SGU");
XmlReader reader = null;
/*try {
reader = new XmlReader(url);
SyndFeed feed = new SyndFeedInput().build(reader);
System.out.println("Feed Title: " + feed.getAuthor());
for (Iterator i = feed.getEntries().iterator(); i.hasNext(););
{
SyndEntry entry = (SyndEntry) i.next();
System.out.println("Title: " + entry.getTitle());
System.out.println("Description: " + entry.getDescription().getValue());
System.out.println("Updated: " + entry.getPublishedDate());
//我希望做类似System.out.println的事情(“Enclosure Url:”+ entry.getEnclosures()) }
} finally {
if (reader != null)
reader.close();
}*/
答案 0 :(得分:1)
试试这个对我有用
SyndEntry entry;
for (int i = 0; i < feed.getEntries().size(); i++) {
entry = (SyndEntry) result.getEntries().get(i);
Log.e("Entry ", "===================================================================");
Log.e("Entry ", "Title : "+entry.getTitle());
Log.e("Entry ", "Link : "+entry.getLink());
Log.e("Entry ", "Uri : "+entry.getUri());
Log.e("Entry ", "Description : "+entry.getDescription().getValue());
SyndEnclosure enc = (SyndEnclosure) entry.getEnclosures().get(0);
Log.e("Entry ", "URL : "+enc.getUrl());
Log.e("Entry ", "Length : "+enc.getLength());
Log.e("Entry ", "Type : "+enc.getType());
Log.e("Entry ", "Pub Date : "+entry.getPublishedDate());
Log.e("Entry ", "===================================================================");
}