Fix RSS multiple <creator> tags error

This commit is contained in:
Shinokuni 2020-07-14 16:36:57 +02:00
parent d9652c725b
commit 9839f320e2
2 changed files with 8 additions and 20 deletions

View File

@ -22,7 +22,7 @@ public final class ItemMatcher {
for (RSSItem item : items) { for (RSSItem item : items) {
Item newItem = new Item(); Item newItem = new Item();
newItem.setAuthor(item.getCreator()); newItem.setAuthor(item.getAuthor());
newItem.setContent(item.getContent()); // Jsoup.clean(item.getContent(), Whitelist.relaxed()) newItem.setContent(item.getContent()); // Jsoup.clean(item.getContent(), Whitelist.relaxed())
newItem.setDescription(item.getDescription()); newItem.setDescription(item.getDescription());
newItem.setGuid(item.getGuid() != null ? item.getGuid() : item.getLink()); newItem.setGuid(item.getGuid() != null ? item.getGuid() : item.getLink());

View File

@ -16,10 +16,6 @@ public class RSSItem {
@Element(name = "link", required = false) @Element(name = "link", required = false)
private String link; private String link;
@ElementList(name = "link", inline = true, required = false)
@Namespace(prefix = "atom")
private List<String> otherLinks;
@Element(name = "imageLink", required = false) @Element(name = "imageLink", required = false)
private String imageLink; private String imageLink;
@ -30,9 +26,9 @@ public class RSSItem {
@ElementList(name = "enclosure", inline = true, required = false) @ElementList(name = "enclosure", inline = true, required = false)
private List<RSSEnclosure> enclosures; private List<RSSEnclosure> enclosures;
@Element(name = "creator", required = false) @ElementList(name = "creator", inline = true, required = false)
@Namespace(prefix = "dc", reference = "http://purl.org/dc/elements/1.1/") @Namespace(prefix = "dc", reference = "http://purl.org/dc/elements/1.1/")
private String creator; private List<String> creator;
@Element(required = false) @Element(required = false)
private String author; private String author;
@ -86,11 +82,11 @@ public class RSSItem {
this.imageLink = imageLink; this.imageLink = imageLink;
} }
public String getCreator() { public List<String> getCreator() {
return creator; return creator;
} }
public void setCreator(String creator) { public void setCreator(List<String> creator) {
this.creator = creator; this.creator = creator;
} }
@ -146,8 +142,8 @@ public class RSSItem {
} }
public String getAuthor() { public String getAuthor() {
if (creator != null) if (creator != null && !creator.isEmpty())
return creator; return creator.get(0);
else else
return author; return author;
} }
@ -155,12 +151,4 @@ public class RSSItem {
public void setAuthor(String author) { public void setAuthor(String author) {
this.author = author; this.author = author;
} }
public List<String> getOtherLinks() {
return otherLinks;
}
public void setOtherLinks(List<String> otherLinks) {
this.otherLinks = otherLinks;
}
} }