Fix ATOM format detection

This commit is contained in:
Shinokuni 2020-07-18 15:00:45 +02:00
parent b54c80437d
commit 3e2c7e7558
1 changed files with 3 additions and 1 deletions

View File

@ -35,6 +35,8 @@ public class RSSQuery {
private static final String RSS_2_REGEX = "rss.*version=\"2.0\""; private static final String RSS_2_REGEX = "rss.*version=\"2.0\"";
private static final String ATOM_REGEX = "<feed.* xmlns=\"http://www.w3.org/2005/Atom\"";
/** /**
* Request the url given in parameter. * Request the url given in parameter.
* This method is synchronous, it <b>has</b> to be called from another thread than the main one. * This method is synchronous, it <b>has</b> to be called from another thread than the main one.
@ -177,7 +179,7 @@ public class RSSQuery {
if (Pattern.compile(RSS_2_REGEX).matcher(content).find()) if (Pattern.compile(RSS_2_REGEX).matcher(content).find())
type = RSSType.RSS_2; type = RSSType.RSS_2;
else if (content.contains("<feed xmlns=\"http://www.w3.org/2005/Atom\"")) else if (Pattern.compile(ATOM_REGEX).matcher(content).find())
type = RSSType.RSS_ATOM; type = RSSType.RSS_ATOM;
else else
type = RSSType.RSS_UNKNOWN; type = RSSType.RSS_UNKNOWN;