From 183f2d47fade089593b5fa49a55cf3f946197827 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 26 Sep 2018 20:36:43 +0200 Subject: [PATCH] Phoronix: fix first comment is article copy --- src/be/nikiroo/gofetch/support/Phoronix.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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); + } } -- 2.27.0