
* lib-randomua * NHentai: Random mobile ua * Madara random UA overhaul * MangaThemesia random UA overhaul * MangaHub random UA overhaul * build errors and warnings * remove preference from Constellar * change to singleton object * network.client * fix copy paste and chapter deep link * exit early * use data class and enum options * missing import * suggested changes Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * re-add empty check to filters * convert to interceptor * update comment Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> * update error message * initialize client by lazy * dont check on excluded Filters Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * newlines * move preference helper function into lib * move preference helper function into lib x2 * move check to lib too * move defaultRandomUserAgentType to constructor * rename the interceptor * organize the interceptor and preference stuff in different files * hide custom ua setting when random ua is enabled * English Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * catch specific exception Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * setVisible() fresh stuff * setVisible() fresh stuff * change summary * workaround * Update error message Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> * Update comment Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
54 lines
1.7 KiB
Kotlin
54 lines
1.7 KiB
Kotlin
package eu.kanade.tachiyomi.extension.pt.yaoitoshokan
|
|
|
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
|
import eu.kanade.tachiyomi.network.GET
|
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
|
import eu.kanade.tachiyomi.source.model.Page
|
|
import okhttp3.OkHttpClient
|
|
import okhttp3.Request
|
|
import org.jsoup.nodes.Document
|
|
import java.text.SimpleDateFormat
|
|
import java.util.Locale
|
|
import java.util.concurrent.TimeUnit
|
|
|
|
class YaoiToshokan : Madara(
|
|
"Yaoi Toshokan",
|
|
"https://www.yaoitoshokan.net",
|
|
"pt-BR",
|
|
SimpleDateFormat("dd MMM yyyy", Locale("pt", "BR")),
|
|
) {
|
|
|
|
override val client: OkHttpClient = super.client.newBuilder()
|
|
.rateLimit(1, 2, TimeUnit.SECONDS)
|
|
.build()
|
|
|
|
// Page has custom link to scan website.
|
|
override val popularMangaUrlSelector = "div.post-title a:not([target])"
|
|
|
|
override fun pageListParse(document: Document): List<Page> {
|
|
countViews(document)
|
|
|
|
return document.select(pageListParseSelector)
|
|
.mapIndexed { index, element ->
|
|
// Had to add trim because of white space in source.
|
|
val imageUrl = element.select("img").attr("data-src").trim()
|
|
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"
|
|
}
|
|
}
|