Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kloping committed Sep 19, 2022
1 parent 56e7398 commit 394c19b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
10 changes: 10 additions & 0 deletions conf/callApi/conf.hml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
kName: "java.lang.String"
vName: "java.util.HashMap"
k: "/ping"
v: ->java.util.HashMap
0: ->io.github.kloping.serialize.HMLObject$Entry0
kName: "java.lang.String"
vName: "java.lang.Boolean"
k: "f930204019"
v: true
3: ->io.github.kloping.serialize.HMLObject$Entry0
kName: "java.lang.String"
vName: "java.util.HashMap"
k: "酷狗点歌"
v: ->java.util.HashMap
0: ->io.github.kloping.serialize.HMLObject$Entry0
kName: "java.lang.String"
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/io/github/gdpl2112/mirai/p1/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import io.github.kloping.io.ReadUtils;
import io.github.kloping.number.NumberUtils;
import org.jsoup.Connection;
import org.jsoup.nodes.Document;

import java.util.concurrent.atomic.AtomicReference;

/**
* @author github.kloping
Expand Down Expand Up @@ -45,14 +48,17 @@ public static String filterId(String url, long gid, long qid, String... args) {
return url;
}

public static Object get(Connection t1, String t0) throws Exception {
public static Object get(Connection t1, String t0, AtomicReference<Document> doc0) throws Exception {
if (t0.equals(ALL)) {
return ReadUtils.readAll(t1.execute().bodyStream(), "utf-8");
}
if (t0.equals(PAR_URL)) {
return t1.get().location();
}
return get0(t1.get().body().text(), t0);
if (doc0.get() == null) {
doc0.set(t1.get());
}
return get0(doc0.get().body().text(), t0);
}

public static Object get0(String t1, String t0) throws Exception {
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/io/github/gdpl2112/mirai/p1/Worker.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.security.NoSuchProviderException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import static io.github.gdpl2112.mirai.p1.CallApiPlugin.conf;
import static io.github.gdpl2112.mirai.p1.Converter.*;
Expand Down Expand Up @@ -118,8 +120,9 @@ private static Message parse(Connection connection, CallTemplate template, Conta
String end = template.out;
try {
int i = 1;
AtomicReference<Document> doc0 = new AtomicReference<>();
for (String outArg : template.outArgs) {
Object o0 = get(connection, outArg);
Object o0 = get(connection, outArg,doc0);
if (o0 != null) {
String o1 = o0.toString();
try {
Expand Down

0 comments on commit 394c19b

Please sign in to comment.