improve image detection by providing only body children nodes

This commit is contained in:
Shinokuni 2019-02-14 22:27:36 +00:00
parent 90d15c57b2
commit 76aef3916a
2 changed files with 4 additions and 2 deletions

View File

@ -124,6 +124,7 @@ public class ItemActivity extends AppCompatActivity {
toolbarLayout.setTitle(itemWithFeed.getFeedName()); toolbarLayout.setTitle(itemWithFeed.getFeedName());
title.setText(item.getTitle()); title.setText(item.getTitle());
if (itemWithFeed.getBgColor() != 0) if (itemWithFeed.getBgColor() != 0)
title.setTextColor(itemWithFeed.getBgColor()); title.setTextColor(itemWithFeed.getBgColor());
else if (itemWithFeed.getColor() != 0) else if (itemWithFeed.getColor() != 0)

View File

@ -116,8 +116,9 @@ public final class HtmlParser {
} }
public static String deleteCoverImage(String content) { public static String deleteCoverImage(String content) {
if (Pattern.compile(COVER_IMAGE_REGEX).matcher(content).find()) { Document document = Jsoup.parse(content);
Document document = Jsoup.parse(content);
if (Pattern.compile(COVER_IMAGE_REGEX).matcher(document.body().html()).find()) {
Elements elements = document.select("img"); Elements elements = document.select("img");
if (!elements.isEmpty()) if (!elements.isEmpty())