Skip to content

Commit

Permalink
紧急修复解析详情页的正则表达式在Gallery Page Thumbnail Labeling设置不为none时解析失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojieonly committed Oct 28, 2024
1 parent a3a0b62 commit 12f2d13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ gradle/wrapper/gradle-wrapper.properties
/app/.cxx/
/Commend.md
/.kotlin/
/download/00000006.gif
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public class GalleryDetailParser {
private static final Pattern PATTERN_PREVIEW_PAGES = Pattern.compile("<td[^>]+><a[^>]+>([\\d,]+)</a></td><td[^>]+>(?:<a[^>]+>)?&gt;(?:</a>)?</td>");
private static final Pattern PATTERN_NORMAL_PREVIEW = Pattern.compile("<div class=\"gdtm\"[^<>]*><div[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*><a[^<>]*href=\"(.+?)\"[^<>]*><img alt=\"([\\d,]+)\"");
private static final Pattern PATTERN_NORMAL_PREVIEW_NEW = Pattern.compile("<a href=\"(.+?)\">[^<>]*<div[^<>]*title=\"Page (\\d+):[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*\"></div>[^<>]*</a>");
private static final Pattern PATTERN_SMALL_PREVIEW = Pattern.compile("<a href=\"(.+?)\"><div[^<>]*title=\"Page (\\d+):[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*>");
private static final Pattern PATTERN_NORMAL_PREVIEW_NEW_WITH_LABEL = Pattern.compile("<a href=\"(.+?)\">[^<>]*<div>[^<>]*<div[^<>]*title=\"Page (\\d+):[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*\">");
private static final Pattern PATTERN_SMALL_PREVIEW = Pattern.compile("<a href=\"(.+?)\">[^<>]*<div[^<>]*title=\"Page (\\d+):[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*>");
private static final Pattern PATTERN_SMALL_PREVIEW_WITH_LABEL = Pattern.compile("<a href=\"(.+?)\">[^<>]*<div>[^<>]*<div[^<>]*title=\"Page (\\d+):[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*>");
private static final Pattern PATTERN_LARGE_PREVIEW = Pattern.compile("<div class=\"gdtl\".+?<a href=\"(.+?)\"><img alt=\"([\\d,]+)\".+?src=\"(.+?)\"");
private static final Pattern PATTERN_LARGE_PREVIEW_NEW = Pattern.compile("<a href=\"(.+?)\">[^<>]*<div title=\"Page (\\d+):[^<>]*\\((.+?)\\)[^<>]*0 0[^<>]*>");
private static final Pattern PATTERN_ARCHIVE_DOWNLOAD = Pattern.compile("onclick=\"return popUp('(.*)',480,320)\">Archive Download</a>");
Expand Down Expand Up @@ -744,6 +746,14 @@ private static NormalPreviewSet parseNormalPreviewSet(String body) throws ParseE
m = PATTERN_NORMAL_PREVIEW_NEW.matcher(body);
parserNewPreview(m, normalPreviewSet);
}
if (normalPreviewSet.size() == 0) {
m = PATTERN_SMALL_PREVIEW_WITH_LABEL.matcher(body);
parserNewPreview(m, normalPreviewSet);
}
if (normalPreviewSet.size() == 0) {
m = PATTERN_NORMAL_PREVIEW_NEW_WITH_LABEL.matcher(body);
parserNewPreview(m, normalPreviewSet);
}

if (normalPreviewSet.size() == 0) {
m = PATTERN_NORMAL_PREVIEW.matcher(body);
Expand Down

0 comments on commit 12f2d13

Please sign in to comment.