From 24612b7d145e6d49e4c386b774994cce8584d072 Mon Sep 17 00:00:00 2001 From: seven332 Date: Wed, 3 Apr 2019 19:37:55 +0800 Subject: [PATCH] Fix parsing thumbnail url --- .../ehviewer/client/parser/GalleryListParser.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 cc4c3a851..297628074 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 @@ -16,6 +16,7 @@ package com.hippo.ehviewer.client.parser; +import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; import com.hippo.ehviewer.EhDB; @@ -181,7 +182,14 @@ public class GalleryListParser { gi.thumbHeight = 0; } // Thumb url - gi.thumb = EhUtils.handleThumbUrlResolution(img.attr("src")); + String url = img.attr("data-src"); + if (TextUtils.isEmpty(url)) { + url = img.attr("src"); + } + if (TextUtils.isEmpty(url)) { + url = null; + } + gi.thumb = EhUtils.handleThumbUrlResolution(url); } // Pages @@ -306,7 +314,7 @@ public class GalleryListParser { //noinspection unchecked result.galleryInfoList = Collections.EMPTY_LIST; return result; - } else if (body.contains("Currently Popular Recent Galleries")) { + } else if (d.getElementsByClass("ptt").isEmpty()) { result.pages = 1; } else { result.pages = Integer.MAX_VALUE;