tags:

views:

375

answers:

1

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.

A: 

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.

Gerardo