Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
catvod committed Mar 5, 2022
1 parent 5a517e4 commit 89e4d1a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/github/catvod/parser/JsonBasic.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static JSONObject parse(LinkedHashMap<String, String> jx, String url) {
try {
String realUrl = reqHeaders.get("url");
reqHeaders.remove("url");
SpiderDebug.log(realUrl + url);
String json = OkHttpUtil.string(realUrl + url, reqHeaders);
JSONObject taskResult = Misc.jsonParse(url, json);
if (taskResult == null)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/github/catvod/parser/JsonParallel.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public static JSONObject parse(LinkedHashMap<String, String> jx, String url) {
Set<String> jxNames = jx.keySet();
for (String jxName : jxNames) {
String parseUrl = jx.get(jxName) + url;
SpiderDebug.log(parseUrl);
futures.add(completionService.submit(new Callable<JSONObject>() {
@Override
public JSONObject call() throws Exception {
try {
HashMap<String, String> reqHeaders = JsonBasic.getReqHeader(parseUrl);
String realUrl = reqHeaders.get("url");
reqHeaders.remove("url");
String json = OkHttpUtil.string(realUrl + url, ParseOKTag, reqHeaders);
SpiderDebug.log(realUrl + url);
String json = OkHttpUtil.string(realUrl + url, Misc.ParseOKTag, reqHeaders);
JSONObject taskResult = Misc.jsonParse(url, json);
taskResult.put("jxFrom", jxName);
SpiderDebug.log(taskResult.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public static JSONObject parse(LinkedHashMap<String, String> jx, String url) {
Set<String> jxNames = jx.keySet();
for (String jxName : jxNames) {
String parseUrl = jx.get(jxName) + url;
SpiderDebug.log(parseUrl);
try {
HashMap<String, String> reqHeaders = JsonBasic.getReqHeader(parseUrl);
String realUrl = reqHeaders.get("url");
reqHeaders.remove("url");
SpiderDebug.log(realUrl + url);
String json = OkHttpUtil.string(realUrl + url, reqHeaders);
JSONObject taskResult = Misc.jsonParse(url, json);
if (taskResult == null)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/github/catvod/parser/MixDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static String mixUrl(String url, String ext) {
if (ext.trim().length() > 0) {
int idx = url.indexOf("?");
if (idx > 0) {
return url.substring(0, idx) + "cat_ext=" + Base64.encodeToString(ext.getBytes(), Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP) + "&" + url.substring(idx);
return url.substring(0, idx + 1) + "cat_ext=" + Base64.encodeToString(ext.getBytes(), Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP) + "&" + url.substring(idx + 1);
}
}
return url;
Expand Down

0 comments on commit 89e4d1a

Please sign in to comment.