From be7478ecec31173ee6b198e161e04176f7a83f75 Mon Sep 17 00:00:00 2001 From: tehcneko <7741672-NekoInverter@users.noreply.gitlab.com> Date: Fri, 21 Jan 2022 17:42:25 +0800 Subject: [PATCH] Fix parsing no unfiltered results --- .../com/hippo/ehviewer/client/parser/GalleryListParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 97ee1cb2c..0228efcef 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 @@ -45,6 +45,8 @@ public class GalleryListParser { private static final String TAG = GalleryListParser.class.getSimpleName(); + private static final String NO_UNFILTERED_TEXT = "No unfiltered results in this page range. You either requested an invalid page or used too aggressive filters."; + private static final Pattern PATTERN_RATING = Pattern.compile("\\d+px"); private static final Pattern PATTERN_THUMB_SIZE = Pattern.compile("height:(\\d+)px;width:(\\d+)px"); private static final Pattern PATTERN_FAVORITE_SLOT = Pattern.compile("background-color:rgba\\((\\d+),(\\d+),(\\d+),"); @@ -347,7 +349,9 @@ public class GalleryListParser { } } if (list.isEmpty()) { - throw new ParseException("No gallery", body); + if (es.size() < 2 || !NO_UNFILTERED_TEXT.equals(es.get(1).text())) { + throw new ParseException("No gallery", body); + } } result.galleryInfoList = list; } catch (Throwable e) {