MCPcopy Create free account
hub / github.com/FongMi/TV / proxy1

Method proxy1

quickjs/src/main/java/com/fongmi/quickjs/crawler/Spider.java:208–221  ·  view source on GitHub ↗
(Map<String, String> params)

Source from the content-addressed store, hash-verified

206 }
207
208 private Object[] proxy1(Map<String, String> params) throws Exception {
209 JSObject obj = submit(() -> JSUtil.toObject(ctx, params)).get();
210 JSArray proxy = (JSArray) call("proxy", obj);
211 String json = submit(proxy::stringify).get();
212 JSONArray array = new JSONArray(json);
213 Map<String, String> headers = array.length() > 3 ? Json.toMap(array.optString(3)) : null;
214 boolean base64 = array.length() > 4 && array.optInt(4) == 1;
215 Object[] result = new Object[4];
216 result[0] = array.optInt(0);
217 result[1] = array.optString(1);
218 result[2] = getStream(array.opt(2), base64);
219 result[3] = headers;
220 return result;
221 }
222
223 private Object[] proxy2(Map<String, String> params) throws Exception {
224 String url = params.get("url");

Callers 1

proxyMethod · 0.95

Calls 6

submitMethod · 0.95
toObjectMethod · 0.95
callMethod · 0.95
toMapMethod · 0.95
getStreamMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected