Parse gallery not available

This commit is contained in:
NekoInverter committed 2021-01-03 12:19:35 +08:00
1 parent 49d8b5d11c
commit 7744ed0cac
2 files changed
+40

No files matched your search

@@ -40,6 +40,7 @@ import com.hippo.ehviewer.client.parser.ForumsParser;
import com.hippo.ehviewer.client.parser.GalleryApiParser;
import com.hippo.ehviewer.client.parser.GalleryDetailParser;
import com.hippo.ehviewer.client.parser.GalleryListParser;
import com.hippo.ehviewer.client.parser.GalleryNotAvailableParser;
import com.hippo.ehviewer.client.parser.GalleryPageApiParser;
import com.hippo.ehviewer.client.parser.GalleryPageParser;
import com.hippo.ehviewer.client.parser.GalleryTokenApiParser;
@@ -106,11 +107,24 @@ public class EhEngine {
throw new EhException("Sad Panda");
}
// Check sad panda(without panda)
if (headers != null && "text/html; charset=UTF-8".equals(headers.get("Content-Type")) &&
"0".equals(headers.get("Content-Length"))) {
throw new EhException("Sad Panda\n(without panda)");
}
// Check kokomade
if (body != null && body.contains(KOKOMADE_URL)) {
throw new EhException("今回はここまで\n\n" + GetText.getString(R.string.kokomade_tip));
}
if (body != null && body.contains("Gallery Not Available - ")) {
String error = GalleryNotAvailableParser.parse(body);
if (!TextUtils.isEmpty(error)) {
throw new EhException(error);
}
}
if (e instanceof ParseException) {
if (body != null && !body.contains("<")) {
throw new EhException(body);