Search in sources :

Example 1 with PiningException

use of com.hippo.ehviewer.client.exception.PiningException in project EhViewer by seven332.

the class GalleryDetailParser method parse.

public static GalleryDetail parse(String body) throws EhException {
    if (body.contains(OFFENSIVE_STRING)) {
        throw new OffensiveException();
    }
    if (body.contains(PINING_STRING)) {
        throw new PiningException();
    }
    // Error info
    Matcher m = PATTERN_ERROR.matcher(body);
    if (m.find()) {
        throw new EhException(m.group(1));
    }
    GalleryDetail galleryDetail = new GalleryDetail();
    Document document = Jsoup.parse(body);
    parseDetail(galleryDetail, document, body);
    galleryDetail.tags = parseTagGroups(document);
    galleryDetail.comments = parseComments(document);
    galleryDetail.previewPages = parsePreviewPages(document, body);
    galleryDetail.previewSet = parsePreviewSet(document, body);
    return galleryDetail;
}
Also used : EhException(com.hippo.ehviewer.client.exception.EhException) Matcher(java.util.regex.Matcher) PiningException(com.hippo.ehviewer.client.exception.PiningException) GalleryDetail(com.hippo.ehviewer.client.data.GalleryDetail) Document(org.jsoup.nodes.Document) OffensiveException(com.hippo.ehviewer.client.exception.OffensiveException)

Aggregations

GalleryDetail (com.hippo.ehviewer.client.data.GalleryDetail)1 EhException (com.hippo.ehviewer.client.exception.EhException)1 OffensiveException (com.hippo.ehviewer.client.exception.OffensiveException)1 PiningException (com.hippo.ehviewer.client.exception.PiningException)1 Matcher (java.util.regex.Matcher)1 Document (org.jsoup.nodes.Document)1