修复在线tts朗读bug

pull/1515/head
gedoor 3 years ago
parent 8ff19ba0c1
commit a858171be2
  1. 8
      app/src/main/java/io/legado/app/utils/NetworkUtils.kt

@ -156,8 +156,8 @@ object NetworkUtils {
* http://www.content.example.com => http://example.com
*/
fun getSubDomain(url: String): String {
return kotlin.runCatching {
val baseUrl = getBaseUrl(url) ?: return ""
return kotlin.runCatching {
val mURL = URL(baseUrl)
val schema: String = mURL.protocol
val host: String = mURL.host
@ -166,7 +166,11 @@ object NetworkUtils {
//PublicSuffixDatabase处理域名
val domain = PublicSuffixDatabase.get().getEffectiveTldPlusOne(host)
if (domain == null) baseUrl else "${schema}://${domain}"
}.getOrDefault(url)
}.getOrDefault(
if (baseUrl.indexOf(".") == baseUrl.lastIndexOf(".")) {
baseUrl.substring(baseUrl.lastIndexOf("/") + 1)
} else baseUrl.substring(baseUrl.indexOf(".") + 1)
)
}
/**

Loading…
Cancel
Save