pull/21/head
fengyuecanzhu 3 years ago
parent ceaed6a5dc
commit c248544a89
  1. 12
      app/src/main/java/xyz/fycz/myreader/entity/LanZouBean.kt
  2. 6
      app/src/main/java/xyz/fycz/myreader/ui/activity/AboutActivity.java
  3. 21
      app/src/main/java/xyz/fycz/myreader/webapi/LanZouApi.kt

@ -0,0 +1,12 @@
package xyz.fycz.myreader.entity
/**
* @author fengyue
* @date 2022/1/22 20:15
*/
data class LanZouBean(
var zt: Int,
var dom: String,
var url: String,
var inf: String
)

@ -119,10 +119,10 @@ public class AboutActivity extends BaseActivity {
String[] str = new String[1]; String[] str = new String[1];
MyAlertDialog.createInputDia(this, getString(R.string.lan_zou_parse), MyAlertDialog.createInputDia(this, getString(R.string.lan_zou_parse),
"格式:链接+逗号+密码(没有密码就不用填)", "", true, "格式:链接+逗号+密码(没有密码就不用填)", "", true,
100, text -> str[0] = text, (dialog, which) -> { 100, text -> str[0] = text.replaceAll("\\s", ""), (dialog, which) -> {
String url, pwd = ""; String url, pwd = "";
if (str[0].contains(",") || str[0].contains(",")) { if (str[0].contains(",") || str[0].contains(",") || str[0].contains("密码:")) {
String[] strs = str[0].split("[,,]"); String[] strs = str[0].split(",|,|密码:");
url = strs[0]; url = strs[0];
pwd = strs[1]; pwd = strs[1];
} else { } else {

@ -5,8 +5,11 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import org.jsoup.Jsoup import org.jsoup.Jsoup
import xyz.fycz.myreader.common.URLCONST import xyz.fycz.myreader.common.URLCONST
import xyz.fycz.myreader.entity.LanZouBean
import xyz.fycz.myreader.util.help.StringHelper import xyz.fycz.myreader.util.help.StringHelper
import xyz.fycz.myreader.util.utils.GSON
import xyz.fycz.myreader.util.utils.OkHttpUtils import xyz.fycz.myreader.util.utils.OkHttpUtils
import xyz.fycz.myreader.util.utils.fromJsonObject
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
import java.util.* import java.util.*
@ -32,7 +35,11 @@ object LanZouApi {
} else { } else {
getUrl2(StringHelper.getSubString(html, "sign=", "&"), url, password) getUrl2(StringHelper.getSubString(html, "sign=", "&"), url, password)
} }
if (url2.contains("file")) {
it.onNext(getRedirectUrl(url2)) it.onNext(getRedirectUrl(url2))
} else {
it.onError(Throwable(url2))
}
it.onComplete() it.onComplete()
} }
} }
@ -74,7 +81,7 @@ object LanZouApi {
} }
private fun getUrl2(o: String): String { private fun getUrl2(o: String): String {
val info = o.split(",").toTypedArray() /*val info = o.split(",").toTypedArray()
val zt = info[0].substring(info[0].indexOf(":") + 1) val zt = info[0].substring(info[0].indexOf(":") + 1)
if (!"1".endsWith(zt)) { if (!"1".endsWith(zt)) {
return "" return ""
@ -82,8 +89,16 @@ object LanZouApi {
var dom = info[1].substring(info[1].indexOf(":") + 2, info[1].lastIndexOf("\"")) var dom = info[1].substring(info[1].indexOf(":") + 2, info[1].lastIndexOf("\""))
var url = info[2].substring(info[2].indexOf(":") + 2, info[2].lastIndexOf("\"")) var url = info[2].substring(info[2].indexOf(":") + 2, info[2].lastIndexOf("\""))
dom = dom.replace("\\", "") dom = dom.replace("\\", "")
url = url.replace("\\", "") url = url.replace("\\", "")*/
return "$dom/file/$url" val lanZouBean = GSON.fromJsonObject<LanZouBean>(o)
lanZouBean?.run {
return if (zt == 1) {
"$dom/file/$url"
} else {
inf
}
}
return ""
} }
/** /**

Loading…
Cancel
Save