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() {
id = id.substring(pos + 1);
}
- while (id.length() < 10) {
- id = "0" + id;
- }
return id;
}
}
protected String getArticleContent(Document doc, Element article) {
Element p = article.getElementsByTag("p").first();
if (p != null) {
- return p.text();
+ return getArticleText(p);
}
return "";
Element a = linkToComments.getElementsByTag("a").first();
if (a != null) {
String url = a.absUrl("href");
- InputStream in = downloader.open(new URL(url));
+ InputStream in = open(new URL(url));
try {
doc = DataUtil.load(in, "UTF-8", url.toString());
return doc.getElementsByClass("b-post");
};
}
+ @Override
+ public void fetch(Story story) throws IOException {
+ super.fetch(story);
+
+ // First comment is a copy of the article, discard it
+ List<Comment> comments = story.getComments();
+ if (comments != null && comments.size() > 1) {
+ comments = comments.subList(1, comments.size());
+ }
+ story.setComments(comments);
+ }
}