Skip to content

Commit

Permalink
fix ohmanhua code
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Aug 22, 2020
1 parent cc9e267 commit bb05197
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions app/src/main/java/com/hiroshi/cimoc/source/Ohmanhua.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.hiroshi.cimoc.source;

import android.annotation.SuppressLint;
import android.util.Base64;

import com.hiroshi.cimoc.model.Chapter;
Expand All @@ -15,16 +14,13 @@
import com.hiroshi.cimoc.utils.DecryptionUtils;
import com.hiroshi.cimoc.utils.StringUtils;

import java.io.UnsupportedEncodingException;

import java.util.LinkedList;
import java.util.List;
import java.util.Objects;

import okhttp3.Headers;
import okhttp3.Request;

import static com.hiroshi.cimoc.utils.DecryptionUtils.desDecrypt;

/**
* Created by Haleyd on 2020/8/7.
*/
Expand All @@ -33,7 +29,7 @@ public class Ohmanhua extends MangaParser {

public static final int TYPE = 71;
public static final String DEFAULT_TITLE = "oh漫画";
public static final String baseUrl = "https://www.ohmanhua.com";
private static final String baseUrl = "https://www.ohmanhua.com";
private static final String serverUrl = "https://img.ohmanhua.com/comic/";

public Ohmanhua(Source source) {
Expand All @@ -45,7 +41,7 @@ public static Source getDefaultSource() {
}

@Override
public Request getSearchRequest(String keyword, int page) throws UnsupportedEncodingException {
public Request getSearchRequest(String keyword, int page) {
String url = "";
if (page == 1) {
url = StringUtils.format(baseUrl+"/search?searchString=%s", keyword);
Expand Down Expand Up @@ -95,7 +91,7 @@ public Request getInfoRequest(String cid) {
}

@Override
public void parseInfo(String html, Comic comic) throws UnsupportedEncodingException {
public void parseInfo(String html, Comic comic) {
Node body = new Node(html);
String title = body.text("dl.fed-deta-info > dd > h1");
String cover = body.attr("dl.fed-deta-info > dt > a","data-original");
Expand Down Expand Up @@ -148,7 +144,8 @@ public List<ImageUrl> parseImages(String html) {
String imgRelativePath = StringUtils.match("imgpath:\"(.+?)\"",decryptedData,1);
String startImg = StringUtils.match("startimg:([0-9]+?),",decryptedData,1);
String totalPages = StringUtils.match("totalimg:([0-9]+?),",decryptedData,1);
for (int i = Integer.parseInt(startImg); i <= Integer.parseInt(totalPages); ++i) {
for (int i = Integer.parseInt(Objects.requireNonNull(startImg));
i <= Integer.parseInt(Objects.requireNonNull(totalPages)); ++i) {
String jpg = StringUtils.format("%04d.jpg", i);
list.add(new ImageUrl(i, serverUrl + imgRelativePath + jpg, false));
}
Expand Down

0 comments on commit bb05197

Please sign in to comment.