优化
This commit is contained in:
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user