Add support for rss feeds which does not have any atom:link tag in their channel tag

This commit is contained in:
Shinokuni 2019-02-04 10:20:21 +00:00
parent 7bbf038aa8
commit 2b0bf9f63d
2 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import com.readrops.readropslibrary.Utils.Utils;
import com.readrops.readropslibrary.localfeed.atom.ATOMFeed;
import com.readrops.readropslibrary.localfeed.json.JSONFeed;
import com.readrops.readropslibrary.localfeed.rss.RSSFeed;
import com.readrops.readropslibrary.localfeed.rss.RSSLink;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
@ -75,6 +76,9 @@ public class RSSNetwork {
switch (type) {
case RSS_2:
RSSFeed rssFeed = serializer.read(RSSFeed.class, xml);
if (rssFeed.getChannel().getFeedUrl() == null) // workaround si the channel does not have any atom:link tag
rssFeed.getChannel().getLinks().add(new RSSLink(null, url));
callback.onSyncSuccess(rssFeed, type);
break;
case RSS_ATOM:

View File

@ -14,6 +14,15 @@ public class RSSLink {
@Attribute(name = "href", required = false)
private String href;
public RSSLink() {
}
public RSSLink(String text, String href) {
this.text = text;
this.href = href;
}
public String getHref() {
return href;
}