diff --git a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.java b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.java index 9a62a7ccc..1ba324757 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.java +++ b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.java @@ -24,7 +24,6 @@ import androidx.annotation.NonNull; import com.hippo.ehviewer.EhDB; import com.hippo.ehviewer.client.EhUtils; import com.hippo.ehviewer.client.data.GalleryInfo; -import com.hippo.ehviewer.client.data.GalleryTagGroup; import com.hippo.ehviewer.client.exception.ParseException; import com.hippo.util.ExceptionUtils; import com.hippo.util.JsoupUtils; @@ -67,16 +66,6 @@ public class GalleryListParser { new String[]{"224", "128", "224"}, }; - private static int parsePages(Document d, String body) throws ParseException { - try { - Elements es = d.getElementsByClass("ptt").first().child(0).child(0).children(); - return Integer.parseInt(es.get(es.size() - 2).text().trim()); - } catch (Throwable e) { - ExceptionUtils.throwIfFatal(e); - throw new ParseException("Can't parse gallery list pages", body); - } - } - private static String parseRating(String ratingStyle) { Matcher m = PATTERN_RATING.matcher(ratingStyle); int num1 = Integer.MIN_VALUE; @@ -147,23 +136,21 @@ public class GalleryListParser { children = child.children(); } gi.title = child.text().trim(); - - Element tbody = JsoupUtils.getElementByTag(glname, "tbody"); - if (tbody != null) { - ArrayList tags = new ArrayList<>(); - GalleryTagGroup[] groups = GalleryDetailParser.parseTagGroups(tbody.children()); - for (GalleryTagGroup group : groups) { - for (int j = 0; j < group.size(); j++) { - tags.add(group.groupName + ":" + group.getTagAt(j)); - } - } - gi.simpleTags = tags.toArray(new String[tags.size()]); - } } if (gi.title == null) { return null; } + // Tags + Elements gts = e.select(".gt, .gtl"); + if (gts.size() != 0) { + ArrayList tags = new ArrayList<>(); + for (Element gt : gts) { + tags.add(gt.attr("title")); + } + gi.simpleTags = tags.toArray(new String[0]); + } + // Category gi.category = EhUtils.UNKNOWN; Element ce = JsoupUtils.getElementByClass(e, "cn");