Skip to content

Commit

Permalink
fix dmzjv2, closed #93
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Aug 30, 2020
1 parent 4214355 commit 28e07f8
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions app/src/main/java/com/hiroshi/cimoc/source/Dmzjv2.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hiroshi.cimoc.source;

import android.util.Log;
import android.util.Pair;

import com.hiroshi.cimoc.model.Chapter;
Expand All @@ -13,6 +14,7 @@
import com.hiroshi.cimoc.parser.SearchIterator;
import com.hiroshi.cimoc.parser.UrlFilter;
import com.hiroshi.cimoc.soup.Node;
import com.hiroshi.cimoc.utils.LogUtil;
import com.hiroshi.cimoc.utils.StringUtils;
import com.hiroshi.cimoc.utils.UicodeBackslashU;

Expand Down Expand Up @@ -118,30 +120,36 @@ public Comic parseInfo(String html, Comic comic) {

@Override
public List<Chapter> parseChapter(String html, Comic comic) {
LogUtil.iLength("hrd",html);
List<Chapter> list = new LinkedList<>();
try {
String JsonString = StringUtils.match(":(\\[\\{.*?\\}\\])\\}\\]", html, 1);
String decodeJsonString = UicodeBackslashU.unicodeToCn(JsonString);
JSONArray JSONArray = new JSONArray(decodeJsonString);
String JsonArrayString = StringUtils.match("initIntroData\\((.*)\\);", html, 1);
String decodeJsonArrayString = UicodeBackslashU.unicodeToCn(JsonArrayString);
JSONArray allJsonArray = new JSONArray(decodeJsonArrayString);
int k=0;
for (int j = 0; j != JSONArray.length(); ++j) {
Long sourceComic=null;
if (comic.getId() == null) {
sourceComic = Long.parseLong(comic.getSource() + sourceToComic + "00");
} else {
sourceComic = Long.parseLong(comic.getSource() + sourceToComic + comic.getId());
for (int i=0;i<allJsonArray.length();i++){
JSONArray JSONArray = allJsonArray.getJSONObject(i).getJSONArray("data");
String tag = allJsonArray.getJSONObject(i).getString("title");
for (int j = 0; j != JSONArray.length(); ++j) {
JSONObject chapter = JSONArray.getJSONObject(j);
String title = chapter.getString("chapter_name");
String comic_id = chapter.getString("comic_id");
String chapter_id = chapter.getString("id");
String path = comic_id + "/" +chapter_id;

Long sourceComic=null;
if (comic.getId() == null) {
sourceComic = Long.parseLong(comic.getSource() + sourceToComic + "00");
} else {
sourceComic = Long.parseLong(comic.getSource() + sourceToComic + comic.getId());
}
Long id = Long.parseLong(sourceComic+"000"+k);
list.add(new Chapter(id, sourceComic, tag+" "+title, path));
k++;
}
Long id = Long.parseLong(sourceComic+"000"+k);
}

JSONObject chapter = JSONArray.getJSONObject(j);
String title = chapter.getString("chapter_name");
String comic_id = chapter.getString("comic_id");
String chapter_id = chapter.getString("id");
String path = comic_id + "/" +chapter_id;

list.add(new Chapter(id, sourceComic, title, path));
k++;
}
} catch (Exception e) {
e.printStackTrace();
}
Expand Down

0 comments on commit 28e07f8

Please sign in to comment.