This commit is contained in:
kunfei
2022-10-16 18:21:01 +08:00
parent 741975d311
commit de0d7c8a2f
@@ -3,6 +3,7 @@ package io.legado.app.help.source
import io.legado.app.data.entities.RssSource import io.legado.app.data.entities.RssSource
import io.legado.app.utils.ACache import io.legado.app.utils.ACache
import io.legado.app.utils.MD5Utils import io.legado.app.utils.MD5Utils
import io.legado.app.utils.NetworkUtils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@@ -32,10 +33,12 @@ suspend fun RssSource.sortUrls(): List<Pair<String, String>> {
aCache.put(sortUrlsKey, str) aCache.put(sortUrlsKey, str)
} }
} }
str?.split("(&&|\n)+".toRegex())?.forEach { c -> str?.split("(&&|\n)+".toRegex())?.forEach { sort ->
val d = c.split("::") val name = sort.substringBefore("::")
if (d.size > 1) val url = sort.substringAfter("::", "")
add(Pair(d[0], d[1])) if (url.isNotEmpty()) {
add(Pair(name, NetworkUtils.getAbsoluteURL(sortUrl, url)))
}
} }
if (isEmpty()) { if (isEmpty()) {
add(Pair("", sourceUrl)) add(Pair("", sourceUrl))