Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
fix manhuabei(MH50)(#293 #292 #290)
Browse files Browse the repository at this point in the history
  • Loading branch information
feilongfl committed Jul 26, 2020
1 parent 68bd5b2 commit 914237e
Showing 1 changed file with 28 additions and 30 deletions.
58 changes: 28 additions & 30 deletions app/src/main/java/com/hiroshi/cimoc/source/MH50.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class MH50 extends MangaParser {

public static final int TYPE = 80;
public static final String DEFAULT_TITLE = "漫画堆";
public static final String website = "https://www.manhuabei.com";

public static Source getDefaultSource() {
return new Source(null, DEFAULT_TITLE, TYPE, true);
Expand All @@ -47,66 +48,63 @@ public MH50(Source source) {

@Override
public Request getSearchRequest(String keyword, int page) {
if (page == 1) {
String url = StringUtils.format("https://m.manhuadui.com/search/?keywords=%s&page=%d", keyword, page);
return HttpUtils.getSimpleMobileRequest(url);
}
return null;
String url = StringUtils.format("%s/search/?keywords=%s&page=%d", website, keyword, page);
return HttpUtils.getSimpleMobileRequest(url);
}

@Override
public SearchIterator getSearchIterator(String html, int page) {
Node body = new Node(html);
return new NodeIterator(body.list(".UpdateList > .itemBox")) {
return new NodeIterator(body.list("ul.list_con_li > li.list-comic")) {
@Override
protected Comic parse(Node node) {
String cid = node.hrefWithSplit(".itemTxt > a", 1);
String title = node.text(".itemTxt > a");
String cover = node.src(".itemImg > a > img");
String cid = node.hrefWithSplit("a", 1);
String title = node.attr("a","title");
String cover = node.src("img");
if (cover.startsWith("//")) cover = "https:" + cover;
String update = node.text(".itemTxt > p.txtItme:eq(3)");
String author = node.text(".itemTxt > p.txtItme:eq(1)");
String update = node.text("p.newPage");
String author = node.text("p.auth");
return new Comic(TYPE, cid, title, cover, update, author);
}
};
}

@Override
public String getUrl(String cid) {
return StringUtils.format("https://m.manhuadui.com/manhua/%s/", cid);
return StringUtils.format("%s/manhua/%s/", website, cid);
}

@Override
protected void initUrlFilterList() {
filter.add(new UrlFilter("m.manhuadui.com"));
filter.add(new UrlFilter(website));
}

@Override
public Request getInfoRequest(String cid) {
String url = StringUtils.format("https://m.manhuadui.com/manhua/%s/", cid);
String url = StringUtils.format("%s/manhua/%s/", website, cid);
return HttpUtils.getSimpleMobileRequest(url);
}

@Override
public void parseInfo(String html, Comic comic) {
Node body = new Node(html);
String intro = body.text("#full-des");
String title = body.text("#comicName");
String cover = body.src("#Cover > img");
String intro = body.text("p.comic_deCon_d");
String title = body.text("div.comic_deCon > h1");
String cover = body.src("div.comic_i_img > img");
if (cover.startsWith("//")) cover = "https:" + cover;
String author = body.text(".Introduct_Sub > .sub_r > .txtItme:eq(0)");
String update = body.text(".Introduct_Sub > .sub_r > .txtItme:eq(4)");
boolean status = isFinish(body.text(".Introduct_Sub > .sub_r > .txtItme:eq(2) > a:eq(3)"));
String author = body.text("ul.comic_deCon_liO > li.eq(0)");
String update = "";
boolean status = isFinish(body.text("ul.comic_deCon_liO > li.eq(1)"));
comic.setInfo(title, cover, update, intro, author, status);
}

@Override
public List<Chapter> parseChapter(String html) {
List<Chapter> list = new LinkedList<>();
Node body = new Node(html);
for (Node node : body.list(".chapter-warp > ul > li > a")) {
String title = node.text();
String path = StringUtils.split(node.href(), "/", 3);
for (Node node : body.list("div.zj_list_con > ul > li")) {
String title = node.attr("a", "title");
String path = StringUtils.split(node.href("a"), "/", 3);
list.add(new Chapter(title, path));
}

Expand All @@ -115,16 +113,16 @@ public List<Chapter> parseChapter(String html) {

@Override
public Request getImagesRequest(String cid, String path) {
String url = StringUtils.format("https://m.manhuadui.com/manhua/%s/%s", cid, path);
String url = StringUtils.format("%s/manhua/%s/%s", website, cid, path);
return HttpUtils.getSimpleMobileRequest(url);
}

private final String[] server = {"https://mhcdn.manhuazj.com"};

@Nullable
private String decrypt(String code) {
String key = "123456781234567G";
String iv = "ABCDEF1G34123412";
String key = "1231M8H8B8123456";
String iv = "A1B2C3D4E5F6G789";
try {
return DecryptionUtils.aesDecrypt(code, key, iv);
} catch (Exception e) {
Expand Down Expand Up @@ -157,7 +155,7 @@ public List<ImageUrl> parseImages(String html) {
List<ImageUrl> list = new LinkedList<>();

//该章节的所有图片url,aes加密
String arrayStringCode = decrypt(StringUtils.match("var chapterImages =\\s*\"(.*?)\";", html, 1));
String arrayStringCode = decrypt(StringUtils.match("var chapterImages =[\\s\\n]*\"(.*?)\";", html, 1));
if (arrayStringCode == null) return list;
JSONArray imageList = JSONArray.parseArray(arrayStringCode);

Expand Down Expand Up @@ -220,9 +218,9 @@ public String getFormat(String... args) {
.concat(args[CATEGORY_PROGRESS]).trim();
String finalPath;
if (path.isEmpty()) {
finalPath = StringUtils.format("https://m.manhuadui.com/list/");
finalPath = StringUtils.format("%s/list/", website);
} else {
finalPath = StringUtils.format("https://m.manhuadui.com/list/%s/?page=%%d", path).replaceAll("\\s+", "-");
finalPath = StringUtils.format("%s/list/%s/?page=%%d", website, path).replaceAll("\\s+", "-");
}
return finalPath;
}
Expand Down Expand Up @@ -381,7 +379,7 @@ protected List<Pair<String, String>> getYear() {

@Override
public Headers getHeader() {
return Headers.of("Referer", "https://m.manhuadui.com/");
return Headers.of("Referer", website);
}

}

0 comments on commit 914237e

Please sign in to comment.