parent
ab89a1c683
commit
57e63fc2de
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Webtoons'
|
appName = 'Tachiyomi: Webtoons'
|
||||||
pkgNameSuffix = 'all.webtoons'
|
pkgNameSuffix = 'all.webtoons'
|
||||||
extClass = '.WebtoonsFactory'
|
extClass = '.WebtoonsFactory'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.all.webtoons
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
class DongmanManhua: WebtoonsDefault("zh", "") {
|
||||||
|
override val baseUrl = "https://www.dongmanmanhua.cn"
|
||||||
|
|
||||||
|
override val name = "Dongman Manhua"
|
||||||
|
|
||||||
|
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
|
||||||
|
.removeAll("Referer")
|
||||||
|
.add("Referer", baseUrl)
|
||||||
|
|
||||||
|
override fun popularMangaRequest(page: Int) = GET("$baseUrl/dailySchedule", headers)
|
||||||
|
|
||||||
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/dailySchedule?sortOrder=UPDATE&webtoonCompleteType=ONGOING", headers)
|
||||||
|
|
||||||
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
|
val mangas = response.asJsoup().select(searchMangaSelector()).map { searchMangaFromElement(it) }
|
||||||
|
return MangasPage(mangas, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun parseDetailsThumbnail(document: Document): String? {
|
||||||
|
return document.select("div.detail_body").attr("style").substringAfter("(").substringBefore(")")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterListRequest(manga: SManga): Request = GET(baseUrl + manga.url, headers)
|
||||||
|
|
||||||
|
override fun chapterListSelector() = "ul#_listUl li"
|
||||||
|
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
|
var document = response.asJsoup()
|
||||||
|
var continueParsing = true
|
||||||
|
val chapters = mutableListOf<SChapter>()
|
||||||
|
|
||||||
|
while (continueParsing) {
|
||||||
|
document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) }
|
||||||
|
document.select("div.paginate a[onclick] + a").let { element ->
|
||||||
|
if (element.isNotEmpty()) document = client.newCall(GET(element.attr("abs:href"), headers)).execute().asJsoup()
|
||||||
|
else continueParsing = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chapters
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterFromElement(element: Element): SChapter {
|
||||||
|
return SChapter.create().apply {
|
||||||
|
name = element.select("span.subj span").text()
|
||||||
|
url = element.select("a").attr("href").substringAfter(".cn")
|
||||||
|
date_upload = chapterParseDate(element.select("span.date").text())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterParseDate(date: String): Long {
|
||||||
|
return SimpleDateFormat("yyyy-M-d", Locale.ENGLISH).parse(date).time
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,10 +4,13 @@ import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
import eu.kanade.tachiyomi.source.model.*
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.*
|
import okhttp3.Headers
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import okhttp3.HttpUrl
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
|
||||||
abstract class Webtoons(override val lang: String, open val langCode: String = lang) : ParsedHttpSource() {
|
abstract class Webtoons(override val lang: String, open val langCode: String = lang) : ParsedHttpSource() {
|
||||||
|
|
||||||
|
@ -66,7 +69,7 @@ abstract class Webtoons(override val lang: String, open val langCode: String = l
|
||||||
// Add completed webtoons, no sorting needed
|
// Add completed webtoons, no sorting needed
|
||||||
document.select("div.daily_lst.comp li a").map { mangas.add(popularMangaFromElement(it)) }
|
document.select("div.daily_lst.comp li a").map { mangas.add(popularMangaFromElement(it)) }
|
||||||
|
|
||||||
return MangasPage(mangas, false)
|
return MangasPage(mangas.distinctBy { it.url }, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/$langCode/dailySchedule?sortOrder=UPDATE&webtoonCompleteType=ONGOING", headers)
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/$langCode/dailySchedule?sortOrder=UPDATE&webtoonCompleteType=ONGOING", headers)
|
||||||
|
@ -116,11 +119,15 @@ abstract class Webtoons(override val lang: String, open val langCode: String = l
|
||||||
|
|
||||||
override fun searchMangaNextPageSelector(): String? = null
|
override fun searchMangaNextPageSelector(): String? = null
|
||||||
|
|
||||||
|
open fun parseDetailsThumbnail(document: Document): String? {
|
||||||
|
val picElement = document.select("#content > div.cont_box > div.detail_body")
|
||||||
|
val discoverPic = document.select("#content > div.cont_box > div.detail_header > span.thmb")
|
||||||
|
return discoverPic.select("img").not("[alt='Representative image']").first()?.attr("src") ?: picElement.attr("style")?.substringAfter("url(")?.substringBeforeLast(")")
|
||||||
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
val detailElement = document.select("#content > div.cont_box > div.detail_header > div.info")
|
val detailElement = document.select("#content > div.cont_box > div.detail_header > div.info")
|
||||||
val infoElement = document.select("#_asideDetail")
|
val infoElement = document.select("#_asideDetail")
|
||||||
val picElement = document.select("#content > div.cont_box > div.detail_body")
|
|
||||||
val discoverPic = document.select("#content > div.cont_box > div.detail_header > span.thmb")
|
|
||||||
|
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.author = detailElement.select(".author:nth-of-type(1)").first()?.ownText()
|
manga.author = detailElement.select(".author:nth-of-type(1)").first()?.ownText()
|
||||||
|
@ -128,7 +135,7 @@ abstract class Webtoons(override val lang: String, open val langCode: String = l
|
||||||
manga.genre = detailElement.select(".genre").joinToString(", ") { it.text() }
|
manga.genre = detailElement.select(".genre").joinToString(", ") { it.text() }
|
||||||
manga.description = infoElement.select("p.summary").text()
|
manga.description = infoElement.select("p.summary").text()
|
||||||
manga.status = infoElement.select("p.day_info").text().orEmpty().let { parseStatus(it) }
|
manga.status = infoElement.select("p.day_info").text().orEmpty().let { parseStatus(it) }
|
||||||
manga.thumbnail_url = discoverPic.select("img").not("[alt='Representative image']").first()?.attr("src") ?: picElement.attr("style")?.substringAfter("url(")?.substringBeforeLast(")")
|
manga.thumbnail_url = parseDetailsThumbnail(document)
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class WebtoonsFactory : SourceFactory {
|
||||||
WebtoonsChineseTraditional(),
|
WebtoonsChineseTraditional(),
|
||||||
WebtoonsIndonesian(),
|
WebtoonsIndonesian(),
|
||||||
WebtoonsThai(),
|
WebtoonsThai(),
|
||||||
|
DongmanManhua(),
|
||||||
|
|
||||||
// Fan translations
|
// Fan translations
|
||||||
WebtoonsTranslate("en", "ENG"),
|
WebtoonsTranslate("en", "ENG"),
|
||||||
|
|
Loading…
Reference in New Issue