mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-21 18:02:42 +01:00
Add TopTruyen (#5133)
This commit is contained in:
parent
68f0a22087
commit
61d0751ee5
@ -131,8 +131,8 @@ abstract class WPComics(
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun String?.toStatus(): Int {
|
open fun String?.toStatus(): Int {
|
||||||
val ongoingWords = listOf("Ongoing", "Updating", "Đang tiến hành", "連載中")
|
val ongoingWords = listOf("Ongoing", "Updating", "Đang tiến hành", "Đang cập nhật", "連載中")
|
||||||
val completedWords = listOf("Complete", "Completed", "Hoàn thành", "完結済み")
|
val completedWords = listOf("Complete", "Completed", "Hoàn thành", "Đã hoàn thành", "完結済み")
|
||||||
return when {
|
return when {
|
||||||
this == null -> SManga.UNKNOWN
|
this == null -> SManga.UNKNOWN
|
||||||
ongoingWords.doesInclude(this) -> SManga.ONGOING
|
ongoingWords.doesInclude(this) -> SManga.ONGOING
|
||||||
|
10
src/vi/toptruyen/build.gradle
Normal file
10
src/vi/toptruyen/build.gradle
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
ext {
|
||||||
|
extName = 'Top Truyen'
|
||||||
|
extClass = '.TopTruyen'
|
||||||
|
themePkg = 'wpcomics'
|
||||||
|
baseUrl = 'https://www.toptruyenviet.info'
|
||||||
|
overrideVersionCode = 0
|
||||||
|
isNsfw = true
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$rootDir/common.gradle"
|
BIN
src/vi/toptruyen/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/vi/toptruyen/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
src/vi/toptruyen/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/vi/toptruyen/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
src/vi/toptruyen/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/vi/toptruyen/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
src/vi/toptruyen/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/vi/toptruyen/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
src/vi/toptruyen/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/vi/toptruyen/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -0,0 +1,77 @@
|
|||||||
|
package eu.kanade.tachiyomi.extension.vi.toptruyen
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
|
import okhttp3.Request
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
class TopTruyen : WPComics(
|
||||||
|
"Top Truyen",
|
||||||
|
"https://www.toptruyenviet.info",
|
||||||
|
"vi",
|
||||||
|
dateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()),
|
||||||
|
gmtOffset = null,
|
||||||
|
) {
|
||||||
|
override val client = super.client.newBuilder()
|
||||||
|
.rateLimit(3)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
override fun popularMangaSelector() = "div.item-manga div.item"
|
||||||
|
|
||||||
|
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
||||||
|
element.select("h3 a").let {
|
||||||
|
title = it.text()
|
||||||
|
setUrlWithoutDomain(it.attr("abs:href"))
|
||||||
|
}
|
||||||
|
thumbnail_url = imageOrNull(element.selectFirst("img")!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun searchMangaSelector() = popularMangaSelector()
|
||||||
|
|
||||||
|
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
|
||||||
|
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
val url = "$baseUrl/$searchPath".toHttpUrl().newBuilder()
|
||||||
|
|
||||||
|
filters.forEach { filter ->
|
||||||
|
when (filter) {
|
||||||
|
is GenreFilter -> filter.toUriPart()?.let { url.addPathSegment(it) }
|
||||||
|
is StatusFilter -> filter.toUriPart()?.let { url.addQueryParameter("status", it) }
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when {
|
||||||
|
query.isNotBlank() -> url.addQueryParameter(queryParam, query)
|
||||||
|
else -> url.addQueryParameter("page", page.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
return GET(url.toString(), headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||||
|
title = document.selectFirst("h1.title-manga")!!.text()
|
||||||
|
description = document.selectFirst("p.detail-summary")?.text()
|
||||||
|
status = document.selectFirst("li.status p.detail-info span")?.text().toStatus()
|
||||||
|
genre = document.select("li.category p.detail-info a")?.joinToString { it.text() }
|
||||||
|
thumbnail_url = imageOrNull(document.selectFirst("img.image-comic")!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterListSelector() = "div.list-chapter li.row:not(.heading):not([style])"
|
||||||
|
|
||||||
|
override fun chapterFromElement(element: Element): SChapter {
|
||||||
|
return super.chapterFromElement(element).apply {
|
||||||
|
date_upload = element.select(".chapters + div").text().toDate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val genresSelector = ".categories-detail ul.nav li:not(.active) a"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user