gpt4 book ai didi

java - 使用 Rome 访问附件内容

转载 作者:行者123 更新时间:2023-12-01 14:37:55 25 4
gpt4 key购买 nike

我正在尝试使用 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();

}*/

最佳答案

试试这个,它对我有用

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 ", "===================================================================");
}

关于java - 使用 Rome 访问附件内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16308999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com