Baozi Manhua: use fixed domain when searching (#14584)

This commit is contained in:
stevenyomi 2022-12-18 20:59:45 +08:00 committed by GitHub
parent 4e41b3332c
commit afda9c1e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,7 @@
## 1.3.16 (2022-12-17)
- 搜索漫画时自动使用 baozimh.com 域名以避免出错
## 1.3.15 (2022-11-20) ## 1.3.15 (2022-11-20)
- 尝试绕过 Cloudflare - 尝试绕过 Cloudflare

View File

@ -5,7 +5,7 @@ ext {
extName = 'Baozi Manhua' extName = 'Baozi Manhua'
pkgNameSuffix = 'zh.baozimanhua' pkgNameSuffix = 'zh.baozimanhua'
extClass = '.Baozi' extClass = '.Baozi'
extVersionCode = 15 extVersionCode = 16
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
@ -187,7 +188,12 @@ class Baozi : ParsedHttpSource(), ConfigurableSource {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
// impossible to search a manga and use the filters // impossible to search a manga and use the filters
return if (query.isNotEmpty()) { return if (query.isNotEmpty()) {
GET("$baseUrl/search?q=$query", headers) val baseUrl = baseUrl.replace("webmota.com", "baozimh.com")
val url = baseUrl.toHttpUrl().newBuilder()
.addEncodedPathSegment("search")
.addQueryParameter("q", query)
.toString()
GET(url, headers)
} else { } else {
val parts = filters.filterIsInstance<UriPartFilter>().joinToString("&") { it.toUriPart() } val parts = filters.filterIsInstance<UriPartFilter>().joinToString("&") { it.toUriPart() }
GET("$baseUrl/classify?page=$page&$parts", headers) GET("$baseUrl/classify?page=$page&$parts", headers)
@ -220,7 +226,8 @@ class Baozi : ParsedHttpSource(), ConfigurableSource {
entries = MIRRORS entries = MIRRORS
entryValues = MIRRORS entryValues = MIRRORS
summary = "已选择:%s\n" + summary = "已选择:%s\n" +
"重启生效,切换简繁体后需要迁移才能刷新漫画标题。" "重启生效,切换简繁体后需要迁移才能刷新漫画标题。\n" +
"搜索漫画时自动使用 baozimh.com 域名以避免出错。"
setDefaultValue(MIRRORS[0]) setDefaultValue(MIRRORS[0])
}.let { screen.addPreference(it) } }.let { screen.addPreference(it) }