I could figure out how to get the image url from the feed. Part of the problem is that Rome does not use Generics; therefore, he was unable to read the <media:thumbnail.. element correctly and, therefore, lost the URL of the image that appears as an attribute.
After debugging, I was able to find the exact parameterized type, and then it was easy :)
List<Element> foreignMarkups = (List<Element>) entry.getForeignMarkup(); for (Element foreignMarkup : foreignMarkups) { String imgURL = foreignMarkup.getAttribute("url").getValue();
This blog helped me understand the architecture of Rome.
And what I found for some news feeds; The URL of the image inside the body element as shown below:
<enclosure url="http://www.wired.com/reviews/wp-content/uploads/2013/02/lights_remote_1-200x100.jpg" type="image/jpeg" length="48000"/>
So I also check the enclosure element if the <media:thumbnail.. element is missing from the feed:
List<SyndEnclosure> encls = entry.getEnclosures(); if(!encls.isEmpty()){ for(SyndEnclosure e : encls){ String imgURL = e.getUrl().toString(); } }
source share