usage of rome media rss plugin

左心房为你撑大大i 提交于 2019-12-22 01:29:54

问题


can anyone explain how to use the rome media-rss plugin found here?

I tried the sample usage and everything else i could find in google (which isn't much) but could not get it to work. Specifically, getModule(MediaModule.URI) which is supposed to return a MediaModule returns null on a media-rss feed. getModules() (note the plural) on that feed returns only one module which is a DCModule (what the hell is a DCModule?)

Perhaps there is something i need to do to configure rome or something to use the plugin..?

And by the way, the feed is from youtube's api.


回答1:


Actually the only configuration that worked for me is using the latest version of Rome (rome-1.0.jar) with the latest version of jdom (jdom.jar version 1.1.1) and get the latest release of mediarss-0.2.2.jar that it's not in the Rome repository, if not came along as an attachment from this forum thread.

Once you have all these elements, just verify that your call to the YouTube API returns an RSS feed because with the standard Atom feed it doesn't work at all and give a try to the following code:

    URL url = new URL(urlAddress);
   SyndFeedInput input = new SyndFeedInput();
   SyndFeed feed = input.build (new XmlReader(url));
   for (Iterator<SyndEntry> i = feed.getEntries().iterator(); i
     .hasNext();) {
    SyndEntry entry = (SyndEntry)i.next();
    System.out.println(entry.getTitle());
    MediaEntryModule m = (MediaEntryModule)entry.getModule(MediaEntryModule.URI);
             System.out.println(m);    
   }

The call to the YouTube API is like this one:

...gdata.youtube.com/feeds/api/videos?q=U2&alt=rss&v=2

and the results (partially) obtained are these ones:

U2 Super Bowl halftime show 2002 - 9/11 Tribute MediaEntryModuleImpl.player=null MediaEntryModuleImpl.mediaGroups[0].defaultContentIndex=null MediaEntryModuleImpl.mediaGroups[0].contents[0].expression=full MediaEntryModuleImpl.mediaGroups[0].contents[0].player=null MediaEntryModuleImpl.mediaGroups[0].contents[0].width=null MediaEntryModuleImpl.mediaGroups[0].contents[0].samplingrate=null MediaEntryModuleImpl.mediaGroups[0].contents[0].type=application/x-shockwave-flash . .

I hope this helps you.



来源:https://stackoverflow.com/questions/1969413/usage-of-rome-media-rss-plugin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!