pull/49/head
kunfei 5 years ago
parent a3ed717db2
commit d5decd9bee
  1. 8
      app/src/main/java/io/legado/app/help/storage/OldRule.kt

@ -1,6 +1,7 @@
package io.legado.app.help.storage
import io.legado.app.constant.AppConst
import io.legado.app.constant.BookType
import io.legado.app.data.entities.BookSource
import io.legado.app.data.entities.rule.*
import io.legado.app.help.storage.Restore.jsonPath
@ -32,6 +33,8 @@ object OldRule {
header = uaToHeader(jsonItem.readString("httpUserAgent"))
searchUrl = toNewUrl(jsonItem.readString("ruleSearchUrl"))
exploreUrl = toNewUrls(jsonItem.readString("ruleFindUrl"))
bookSourceType =
if (jsonItem.readString("bookSourceType") == "AUDIO") BookType.audio else BookType.default
if (exploreUrl.isNullOrBlank()) {
enabledExplore = false
}
@ -135,7 +138,10 @@ object OldRule {
.replace("searchPage([-+]1)".toRegex(), "{{page$1}}")
.replace("searchPage", "{{page}}")
for ((index, item) in jsList.withIndex()) {
url = url.replace("$$index", item.replace("searchKey", "key").replace("searchPage", "page"))
url = url.replace(
"$$index",
item.replace("searchKey", "key").replace("searchPage", "page")
)
}
urlList = url.split("@")
url = urlList[0]

Loading…
Cancel
Save