|
|
@ -67,10 +67,6 @@ class AnalyzeUrl( |
|
|
|
} |
|
|
|
} |
|
|
|
headerMapF?.let { |
|
|
|
headerMapF?.let { |
|
|
|
headerMap.putAll(it) |
|
|
|
headerMap.putAll(it) |
|
|
|
if (it.containsKey("proxy")) { |
|
|
|
|
|
|
|
proxy = it["proxy"] |
|
|
|
|
|
|
|
headerMap.remove("proxy") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//替换参数 |
|
|
|
//替换参数 |
|
|
|
analyzeJs(key, page, speakText, speakSpeed, book) |
|
|
|
analyzeJs(key, page, speakText, speakSpeed, book) |
|
|
@ -191,6 +187,7 @@ class AnalyzeUrl( |
|
|
|
val option = GSON.fromJsonObject<UrlOption>(urlArray[1]) |
|
|
|
val option = GSON.fromJsonObject<UrlOption>(urlArray[1]) |
|
|
|
option?.let { _ -> |
|
|
|
option?.let { _ -> |
|
|
|
option.method?.let { if (it.equals("POST", true)) method = RequestMethod.POST } |
|
|
|
option.method?.let { if (it.equals("POST", true)) method = RequestMethod.POST } |
|
|
|
|
|
|
|
option.proxy?.let { proxy = it } |
|
|
|
option.headers?.let { headers -> |
|
|
|
option.headers?.let { headers -> |
|
|
|
if (headers is Map<*, *>) { |
|
|
|
if (headers is Map<*, *>) { |
|
|
|
headers.forEach { entry -> |
|
|
|
headers.forEach { entry -> |
|
|
@ -304,19 +301,19 @@ class AnalyzeUrl( |
|
|
|
method == RequestMethod.POST -> { |
|
|
|
method == RequestMethod.POST -> { |
|
|
|
if (fieldMap.isNotEmpty()) { |
|
|
|
if (fieldMap.isNotEmpty()) { |
|
|
|
HttpHelper |
|
|
|
HttpHelper |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset) |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset, proxy) |
|
|
|
.postMap(url, fieldMap, headerMap) |
|
|
|
.postMap(url, fieldMap, headerMap) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
HttpHelper |
|
|
|
HttpHelper |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset) |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset, proxy) |
|
|
|
.postBody(url, requestBody!!, headerMap) |
|
|
|
.postBody(url, requestBody!!, headerMap) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
fieldMap.isEmpty() -> HttpHelper |
|
|
|
fieldMap.isEmpty() -> HttpHelper |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset) |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset, proxy) |
|
|
|
.get(url, headerMap) |
|
|
|
.get(url, headerMap) |
|
|
|
else -> HttpHelper |
|
|
|
else -> HttpHelper |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset) |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset, proxy) |
|
|
|
.getMap(url, fieldMap, headerMap) |
|
|
|
.getMap(url, fieldMap, headerMap) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -343,51 +340,24 @@ class AnalyzeUrl( |
|
|
|
val res = when { |
|
|
|
val res = when { |
|
|
|
method == RequestMethod.POST -> { |
|
|
|
method == RequestMethod.POST -> { |
|
|
|
if (fieldMap.isNotEmpty()) { |
|
|
|
if (fieldMap.isNotEmpty()) { |
|
|
|
if (proxy == null) { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
HttpHelper |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset) |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset, proxy) |
|
|
|
.postMapAsync(url, fieldMap, headerMap) |
|
|
|
.postMapAsync(url, fieldMap, headerMap) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
HttpHelper |
|
|
|
HttpHelper |
|
|
|
.getApiServiceWithProxy<HttpPostApi>(baseUrl, charset, proxy) |
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset, proxy) |
|
|
|
.postMapAsync(url, fieldMap, headerMap) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (proxy == null) { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
|
|
|
|
.getApiService<HttpPostApi>(baseUrl, charset) |
|
|
|
|
|
|
|
.postBodyAsync(url, requestBody!!, headerMap) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
|
|
|
|
.getApiServiceWithProxy<HttpPostApi>(baseUrl, charset, proxy) |
|
|
|
|
|
|
|
.postBodyAsync(url, requestBody!!, headerMap) |
|
|
|
.postBodyAsync(url, requestBody!!, headerMap) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fieldMap.isEmpty() -> { |
|
|
|
fieldMap.isEmpty() -> { |
|
|
|
if (proxy == null) { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
|
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset) |
|
|
|
|
|
|
|
.getAsync(url, headerMap) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
HttpHelper |
|
|
|
.getApiServiceWithProxy<HttpGetApi>(baseUrl, charset, proxy) |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset, proxy) |
|
|
|
.getAsync(url, headerMap) |
|
|
|
.getAsync(url, headerMap) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
else -> { |
|
|
|
if (proxy == null) { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
HttpHelper |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset) |
|
|
|
.getApiService<HttpGetApi>(baseUrl, charset, proxy) |
|
|
|
.getMapAsync(url, fieldMap, headerMap) |
|
|
|
.getMapAsync(url, fieldMap, headerMap) |
|
|
|
} else { |
|
|
|
|
|
|
|
HttpHelper |
|
|
|
|
|
|
|
.getApiServiceWithProxy<HttpGetApi>(baseUrl, charset, proxy) |
|
|
|
|
|
|
|
.getMapAsync(url, fieldMap, headerMap) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return Res(NetworkUtils.getUrl(res), res.body()) |
|
|
|
return Res(NetworkUtils.getUrl(res), res.body()) |
|
|
@ -448,6 +418,7 @@ class AnalyzeUrl( |
|
|
|
val webView: Any?, |
|
|
|
val webView: Any?, |
|
|
|
val headers: Any?, |
|
|
|
val headers: Any?, |
|
|
|
val body: Any?, |
|
|
|
val body: Any?, |
|
|
|
|
|
|
|
val proxy: String? |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|