Junmeitu cleanup (#380)

This commit is contained in:
Mike 2024-01-19 07:29:31 -05:00 committed by GitHub
parent 5618a46c96
commit ed81bf6a6e
2 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Junmeitu' extName = 'Junmeitu'
extClass = '.Junmeitu' extClass = '.Junmeitu'
extVersionCode = 5 extVersionCode = 6
isNsfw = true isNsfw = true
} }

View File

@ -78,7 +78,8 @@ class Junmeitu : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create() val manga = SManga.create()
manga.title = document.selectFirst(".news-title,.title")!!.text() manga.title = document.selectFirst(".news-title,.title")!!.text()
manga.description = document.select(".news-info,.picture-details").text() + "\n" + document.select(".introduce").text() manga.description = "${document.select(".news-info, .picture-details")
.joinToString { it.text() }}\n" + document.select(".introduce").text()
manga.genre = document.select(".relation_tags > a").joinToString { it.text() } manga.genre = document.select(".relation_tags > a").joinToString { it.text() }
manga.status = SManga.COMPLETED manga.status = SManga.COMPLETED
return manga return manga
@ -86,20 +87,18 @@ class Junmeitu : ParsedHttpSource() {
override fun chapterFromElement(element: Element): SChapter { override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create() val chapter = SChapter.create()
chapter.setUrlWithoutDomain(element.select(".position a:last-child").first()!!.attr("abs:href")) chapter.setUrlWithoutDomain(element.select(".position a:last-child").attr("abs:href"))
chapter.chapter_number = -2f
chapter.name = "Gallery" chapter.name = "Gallery"
return chapter return chapter
} }
override fun chapterListSelector() = "html" override fun chapterListSelector() = "div.position"
// Pages // Pages
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val numPages = document.select(".pages > a:nth-last-of-type(2)").text().toIntOrNull() val numPages = document.select(".pages > a:nth-last-of-type(2)").text().toIntOrNull()
val newsBody = document.selectFirst(Evaluator.Class("news-body")) val newsBody = document.selectFirst(Evaluator.Class("news-body"))
if (newsBody == null) { if (newsBody == null) {
val baseUrl = this.baseUrl
val prefix = document.location().run { val prefix = document.location().run {
val index = lastIndexOf('.') // .html val index = lastIndexOf('.') // .html
baseUrl + "/ajax_" + substring(baseUrl.length + 1, index) + '-' baseUrl + "/ajax_" + substring(baseUrl.length + 1, index) + '-'