/**
* @see org.olat.modules.webFeed.managers.FeedManager#isValidFeedUrl(java.lang.String)
*/
@Override
public ValidatedURL validateFeedUrl(String url, String type) {
SyndFeedInput input = new SyndFeedInput();
boolean modifiedProtocol = false;
try {
if (url != null) {
url = url.trim();
}
if (url.startsWith("feed") || url.startsWith("itpc")) {
// accept feed(s) urls like generated in safari browser
url = "http" + url.substring(4);
modifiedProtocol = true;
}
URL realUrl = new URL(url);
SyndFeed feed = input.build(new XmlReader(realUrl));
if(!feed.getEntries().isEmpty()) {
//check for enclosures
SyndEntry entry = (SyndEntry)feed.getEntries().get(0);
if(type != null && type.indexOf("BLOG") >= 0) {
return new ValidatedURL(url, ValidatedURL.State.VALID);