|
|
@ -97,9 +97,17 @@ object LanZouApi { |
|
|
|
): Coroutine<List<LanZouFile>?> { |
|
|
|
): Coroutine<List<LanZouFile>?> { |
|
|
|
return Coroutine.async { |
|
|
|
return Coroutine.async { |
|
|
|
val params = if (page == 1) { |
|
|
|
val params = if (page == 1) { |
|
|
|
getFoldParams(getProxyClient().newCallResponseBody { url(foldUrl) }.text(), page, pwd) |
|
|
|
getFoldParams( |
|
|
|
|
|
|
|
getProxyClient().newCallResponseBody { url(foldUrl) }.text(), |
|
|
|
|
|
|
|
page, |
|
|
|
|
|
|
|
pwd |
|
|
|
|
|
|
|
) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
paramCathe[foldUrl] ?: getFoldParams(getProxyClient().newCallResponseBody { url(foldUrl) }.text(), page, pwd) |
|
|
|
paramCathe[foldUrl] ?: getFoldParams(getProxyClient().newCallResponseBody { |
|
|
|
|
|
|
|
url( |
|
|
|
|
|
|
|
foldUrl |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}.text(), page, pwd) |
|
|
|
} |
|
|
|
} |
|
|
|
params["pg"] = page |
|
|
|
params["pg"] = page |
|
|
|
paramCathe[foldUrl] = params |
|
|
|
paramCathe[foldUrl] = params |
|
|
@ -160,11 +168,15 @@ object LanZouApi { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun getFileUrl(url: String, password: String = ""): Observable<String> { |
|
|
|
fun getFileUrl(url: String, password: String = ""): Observable<String> { |
|
|
|
return Observable.create { |
|
|
|
return Observable.create { |
|
|
|
val html = OkHttpUtils.getHtml(url) |
|
|
|
var html = OkHttpUtils.getHtml(url) |
|
|
|
val url2 = if (password.isEmpty()) { |
|
|
|
val url2 = if (password.isEmpty()) { |
|
|
|
val url1 = getUrl1(html) |
|
|
|
val url1 = getUrl1(html) |
|
|
|
val data = StringUtils.getSubString(OkHttpUtils.getHtml(url1), "},", "},") |
|
|
|
html = OkHttpUtils.getHtml(url1) |
|
|
|
val key = getKeyValueByKey(data, "sign") + "&" + getKeyValueByKey(data, "websignkey") |
|
|
|
val data = getDataString(html) |
|
|
|
|
|
|
|
Log.d("LanZouUtils", "data:$data") |
|
|
|
|
|
|
|
val key = getKeyValueByKey(html, data, "sign") + |
|
|
|
|
|
|
|
"&" + getKeyValueByKey(html, data, "websignkey") |
|
|
|
|
|
|
|
Log.d("LanZouUtils", "key:$key") |
|
|
|
getUrl2(key, url1) |
|
|
|
getUrl2(key, url1) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
getUrl2(StringHelper.getSubString(html, "sign=", "&"), url, password) |
|
|
|
getUrl2(StringHelper.getSubString(html, "sign=", "&"), url, password) |
|
|
@ -178,13 +190,19 @@ object LanZouApi { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getDataString(html: String): String { |
|
|
|
|
|
|
|
val start = html.lastIndexOf("data :") + "data :".length |
|
|
|
|
|
|
|
val end = html.indexOf("},", start) + 1 |
|
|
|
|
|
|
|
return html.substring(start, end) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getUrl1(html: String): String { |
|
|
|
fun getUrl1(html: String): String { |
|
|
|
val doc = Jsoup.parse(html) |
|
|
|
val doc = Jsoup.parse(html) |
|
|
|
return URLCONST.LAN_ZOU_URL + doc.getElementsByTag("iframe").attr("src") |
|
|
|
return URLCONST.LAN_ZOU_URL + doc.getElementsByTag("iframe").attr("src") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getKeyValueByKey(html: String, key: String): String { |
|
|
|
fun getKeyValueByKey(html: String, data: String, key: String): String { |
|
|
|
val keyName = StringHelper.getSubString(html, "'$key':", ",") |
|
|
|
val keyName = StringHelper.getSubString(data, "'$key':", ",") |
|
|
|
return if (keyName.endsWith("'")) { |
|
|
|
return if (keyName.endsWith("'")) { |
|
|
|
key + "=" + keyName.replace("'", "") |
|
|
|
key + "=" + keyName.replace("'", "") |
|
|
|
} else { |
|
|
|
} else { |
|
|
|