Skip to content

Commit bb5ad49

Browse files
committed
fix html comments
1 parent 193442d commit bb5ad49

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeCommentsInfoItemExtractor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import java.text.SimpleDateFormat;
66
import java.util.Locale;
77

8+
import org.jsoup.Jsoup;
9+
import org.jsoup.nodes.Document;
810
import org.schabi.newpipe.extractor.ServiceList;
911
import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor;
1012
import org.schabi.newpipe.extractor.exceptions.ParsingException;
@@ -59,7 +61,12 @@ public Integer getLikeCount() throws ParsingException {
5961
@Override
6062
public String getCommentText() throws ParsingException {
6163
String htmlText = JsonUtils.getString(item, "text");
62-
return htmlText.replaceAll("(?s)<[^>]*>(\\s*<[^>]*>)*", "");
64+
try {
65+
Document doc = Jsoup.parse(htmlText);
66+
return doc.body().text();
67+
}catch(Exception e) {
68+
return htmlText.replaceAll("(?s)<[^>]*>(\\s*<[^>]*>)*", "");
69+
}
6370
}
6471

6572
@Override

0 commit comments

Comments
 (0)