Tachiyomi-Extensions/multisrc/overrides/madara/mangatk/src/MangaTK.kt

36 lines
1.1 KiB
Kotlin

package eu.kanade.tachiyomi.extension.en.mangatk
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Page
import okhttp3.Request
import org.jsoup.nodes.Document
class MangaTK : Madara("MangaTK", "https://mangatk.com", "en") {
override fun popularMangaSelector() = "div.manga-item"
override val popularMangaUrlSelector = "div > h3 > a"
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/manga/page/$page?orderby=trending")
}
override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/manga/page/$page?orderby=latest")
}
override val pageListParseSelector = "div.read-content img"
override fun pageListParse(document: Document): List<Page> {
return document.select(pageListParseSelector).mapIndexed { index, element ->
Page(
index,
document.location(),
element?.let {
it.absUrl(if (it.hasAttr("data-src")) "data-src" else "src")
}
)
}
}
}