/* * Copyright (C) 2014 Hippo Seven * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hippo.ehviewer.ehclient; import com.hippo.ehviewer.data.Comment; import com.hippo.ehviewer.data.LargePreviewList; import com.hippo.ehviewer.data.NormalPreviewList; import com.hippo.ehviewer.data.PreviewList; import com.hippo.ehviewer.util.EhUtils; import com.hippo.ehviewer.util.Utils; import java.util.Collections; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.regex.Matcher; import java.util.regex.Pattern; public class DetailParser { private static final String OFFENSIVE_STRING = "
(And if you choose to ignore this warning, you lose all rights to complain about it in the future.)
"; private static final String PINING_STRING = "This gallery is pining for the fjords.
"; public static final int DETAIL = 0x1; public static final int TAG = 0x2; public static final int PREVIEW_INFO = 0x4; public static final int PREVIEW = 0x8; public static final int COMMENT = 0x10; public static final int OFFENSIVE = 0x20; public static final int PINING = 0x40; public static final int ERROR = 0x80; private static final CommentSort cs = new CommentSort(); public String eMesg; public String thumb; public String title; public String title_jpn; public int category; public String uploader; public String posted; public int pages; public String size; public String resized; public String parent; public String visible; public String language; public int people; public float rating; public String firstPage; public int previewPerPage; public int previewSum; public LinkedHashMap([^<]+)
"); m = p.matcher(body); if (m.find()) { eMesg = m.group(1); return ERROR; } // Get detail if ((mode & DETAIL) != 0) { p = Pattern .compile("