Set desktop UA and update URL for some Chinese sources (#880)

* Set desktop UA and update URL for some Chinese sources

* Update linked websites
This commit is contained in:
stevenyomi 2024-02-01 17:03:22 +00:00 committed by GitHub
parent 9a72720a99
commit dabe87193a
10 changed files with 29 additions and 11 deletions

View File

@ -21,6 +21,10 @@
android:host="xmanhua.com"
android:pathPattern="/..*"
android:scheme="https" />
<data
android:host="yymanhua.com"
android:pathPattern="/..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>

View File

@ -1,7 +1,7 @@
ext {
extName = 'Mangabz'
extClass = '.Mangabz'
extVersionCode = 7
extVersionCode = 8
}
apply from: "$rootDir/common.gradle"

View File

@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import okhttp3.Response
@ -26,7 +27,7 @@ import uy.kohesive.injekt.api.get
class Mangabz : MangabzTheme("Mangabz"), ConfigurableSource {
override val baseUrl: String
private val _baseUrl: String
override val client: OkHttpClient
private val urlSuffix: String
@ -34,7 +35,7 @@ class Mangabz : MangabzTheme("Mangabz"), ConfigurableSource {
init {
val preferences = Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
val mirror = preferences.mirror
baseUrl = "https://" + mirror.domain
_baseUrl = "https://" + mirror.domain
urlSuffix = mirror.urlSuffix
val cookieInterceptor = CookieInterceptor(mirror.domain, mirror.langCookie, preferences.lang)
@ -44,6 +45,16 @@ class Mangabz : MangabzTheme("Mangabz"), ConfigurableSource {
.build()
}
private val isCi = System.getenv("CI") == "true"
override val baseUrl get() = when {
isCi -> MIRRORS.joinToString("#, ") { "https://$it" }
else -> _baseUrl
}
override fun headersBuilder() = Headers.Builder()
.add("Referer", _baseUrl)
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/121.0")
private fun SManga.stripMirror() = apply {
val old = url
url = buildString(old.length) {

View File

@ -24,8 +24,6 @@ abstract class MangabzTheme(
override val supportsLatest = true
override fun headersBuilder() = super.headersBuilder().add("Referer", baseUrl)
override fun popularMangaRequest(page: Int) = GET("$baseUrl/manga-list-p$page/", headers)
override fun popularMangaParse(response: Response) = searchMangaParse(response)

View File

@ -47,6 +47,7 @@ val MIRRORS
get() = arrayOf(
Mirror("mangabz.com", "bz/", "mangabz_lang"),
Mirror("xmanhua.com", "xm/", "xmanhua_lang"),
Mirror("yymanhua.com", "yy/", "yymanhua_lang"),
)
class Mirror(

View File

@ -1,7 +1,7 @@
ext {
extName = 'WNACG'
extClass = '.wnacg'
extVersionCode = 14
extVersionCode = 15
isNsfw = true
}

View File

@ -17,7 +17,6 @@ import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
// URL can be found at https://www.wnacglink.top/
class wnacg : ParsedHttpSource(), ConfigurableSource {
override val name = "紳士漫畫"
override val lang = "zh"
@ -67,7 +66,8 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
return GET(builder.build(), headers)
}
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
override fun headersBuilder() = Headers.Builder()
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/121.0")
.set("referer", baseUrl)
.set("sec-fetch-mode", "no-cors")
.set("sec-fetch-site", "cross-site")

View File

@ -1,7 +1,7 @@
ext {
extName = 'Zerobyw'
extClass = '.Zerobyw'
extVersionCode = 17
extVersionCode = 18
}
apply from: "$rootDir/common.gradle"

View File

@ -11,7 +11,7 @@ import okhttp3.OkHttpClient
import okhttp3.Response
import java.io.IOException
private const val DEFAULT_BASE_URL = "http://www.zerobyw007.com"
private const val DEFAULT_BASE_URL = "http://www.zerobywgbo2.com"
private const val BASE_URL_PREF = "ZEROBYW_BASEURL"
private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl"
@ -34,7 +34,7 @@ fun getBaseUrlPreference(context: Context) = EditTextPreference(context).apply {
key = BASE_URL_PREF
title = "网址"
summary = "正常情况下会自动更新。" +
"如果出现错误,请在 GitHub 上报告,并且可以在 GitHub 仓库 zerozzz123456/1 找到最新网址手动填写。" +
"如果出现错误,请在 GitHub 上报告,并且可以在 https://zerobyw.github.io/ 找到最新网址手动填写。" +
"填写时按照 $DEFAULT_BASE_URL 格式。"
setDefaultValue(DEFAULT_BASE_URL)

View File

@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
import okhttp3.Response
@ -38,6 +39,9 @@ class Zerobyw : ParsedHttpSource(), ConfigurableSource {
private val isCi = System.getenv("CI") == "true"
override fun headersBuilder() = Headers.Builder()
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/121.0")
// Popular
// Website does not provide popular manga, this is actually latest manga