From: Niki Roo Date: Wed, 26 Sep 2018 18:36:43 +0000 (+0200) Subject: Phoronix: fix first comment is article copy X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=183f2d47fade089593b5fa49a55cf3f946197827;p=gofetch.git Phoronix: fix first comment is article copy --- diff --git a/src/be/nikiroo/gofetch/support/Phoronix.java b/src/be/nikiroo/gofetch/support/Phoronix.java index 74096ad..c73ddc7 100644 --- a/src/be/nikiroo/gofetch/support/Phoronix.java +++ b/src/be/nikiroo/gofetch/support/Phoronix.java @@ -14,6 +14,9 @@ import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; +import be.nikiroo.gofetch.data.Comment; +import be.nikiroo.gofetch.data.Story; + class Phoronix extends BasicSupport { @Override public String getDescription() { @@ -236,4 +239,15 @@ class Phoronix extends BasicSupport { }; } + @Override + public void fetch(Story story) throws IOException { + super.fetch(story); + + // First comment is a copy of the article, discard it + List comments = story.getComments(); + if (comments != null && comments.size() > 1) { + comments = comments.subList(1, comments.size()); + } + story.setComments(comments); + } }