parent
f1385cbdba
commit
c50ac5ee87
|
@ -2,8 +2,11 @@ package eu.kanade.tachiyomi.extension.pt.yaoitoshokan
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import okhttp3.Headers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -11,12 +14,15 @@ import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class YaoiToshokan : Madara(
|
class YaoiToshokan : Madara(
|
||||||
"Yaoi Toshokan",
|
"Yaoi Toshokan",
|
||||||
"https://yaoitoshokan.net",
|
"https://www.yaoitoshokan.net",
|
||||||
"pt-BR",
|
"pt-BR",
|
||||||
SimpleDateFormat("dd MMM yyyy", Locale("pt", "BR"))
|
SimpleDateFormat("dd MMM yyyy", Locale("pt", "BR"))
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override val client: OkHttpClient = super.client.newBuilder()
|
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
|
||||||
|
.removeAll("User-Agent")
|
||||||
|
|
||||||
|
override val client: OkHttpClient = network.client.newBuilder()
|
||||||
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
|
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
@ -24,11 +30,28 @@ class YaoiToshokan : Madara(
|
||||||
override val popularMangaUrlSelector = "div.post-title a:not([target])"
|
override val popularMangaUrlSelector = "div.post-title a:not([target])"
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
countViews(document)
|
||||||
|
|
||||||
return document.select(pageListParseSelector)
|
return document.select(pageListParseSelector)
|
||||||
.mapIndexed { index, element ->
|
.mapIndexed { index, element ->
|
||||||
// Had to add trim because of white space in source.
|
// Had to add trim because of white space in source.
|
||||||
val imageUrl = element.select("img").attr("data-src").trim()
|
val imageUrl = element.select("img").attr("data-src").trim()
|
||||||
Page(index, document.location(), imageUrl)
|
Page(index, "$baseUrl/", imageUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun imageRequest(page: Page): Request {
|
||||||
|
val newHeaders = headersBuilder()
|
||||||
|
.add("Accept", ACCEPT_IMAGE)
|
||||||
|
.add("Accept-Language", ACCEPT_LANGUAGE)
|
||||||
|
.set("Referer", page.url)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
return GET(page.imageUrl!!, newHeaders)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val ACCEPT_IMAGE = "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
|
||||||
|
private const val ACCEPT_LANGUAGE = "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,gl;q=0.5"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
||||||
SingleLang("XManga", "https://xmanga.io", "en", isNsfw = true),
|
SingleLang("XManga", "https://xmanga.io", "en", isNsfw = true),
|
||||||
SingleLang("XuN Scans", "https://xunscans.xyz", "en", overrideVersionCode = 2),
|
SingleLang("XuN Scans", "https://xunscans.xyz", "en", overrideVersionCode = 2),
|
||||||
SingleLang("Yaoi Hentai", "https://yaoihentai.me", "en", isNsfw = true),
|
SingleLang("Yaoi Hentai", "https://yaoihentai.me", "en", isNsfw = true),
|
||||||
SingleLang("Yaoi Toshokan", "https://yaoitoshokan.net", "pt-BR", isNsfw = true, overrideVersionCode = 3),
|
SingleLang("Yaoi Toshokan", "https://yaoitoshokan.net", "pt-BR", isNsfw = true, overrideVersionCode = 4),
|
||||||
SingleLang("Yaoi.mobi", "https://yaoi.mobi", "en", isNsfw = true, className = "YaoiManga", pkgName = "yaoimanga", overrideVersionCode = 4),
|
SingleLang("Yaoi.mobi", "https://yaoi.mobi", "en", isNsfw = true, className = "YaoiManga", pkgName = "yaoimanga", overrideVersionCode = 4),
|
||||||
SingleLang("YaoiScan", "https://yaoiscan.com", "en", isNsfw = true),
|
SingleLang("YaoiScan", "https://yaoiscan.com", "en", isNsfw = true),
|
||||||
SingleLang("YaoiToon", "https://yaoitoon.com", "en", isNsfw = true),
|
SingleLang("YaoiToon", "https://yaoitoon.com", "en", isNsfw = true),
|
||||||
|
|
Loading…
Reference in New Issue