Tachiyomi-Extensions/multisrc/overrides/madara/mangateca/src/MangaTeca.kt

36 lines
1.2 KiB
Kotlin

package eu.kanade.tachiyomi.extension.pt.mangateca
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.SChapter
import okhttp3.Headers
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.Locale
class MangaTeca : Madara(
"MangaTeca",
"https://www.mangateca.com",
"pt-BR",
SimpleDateFormat("MMMM dd, yyyy", Locale("pt", "BR"))
) {
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("User-Agent", USER_AGENT)
.add("Referer", baseUrl)
.add("Origin", baseUrl)
override fun chapterFromElement(element: Element): SChapter {
val parsedChapter = super.chapterFromElement(element)
parsedChapter.date_upload = element.select("img").firstOrNull()?.attr("alt")
?.let { parseChapterDate(it) }
?: parseChapterDate(element.select("span.chapter-release-date i").firstOrNull()?.text())
return parsedChapter
}
companion object {
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"
}
}