Ninemanga fixes (#1619)

* NineManga - special characters fix

* Change searches with an apostrophe
This commit is contained in:
Mike 2019-10-07 22:46:51 -04:00 committed by arkon
parent e5b4c01cd2
commit d4014338fe
3 changed files with 34 additions and 15 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: NineManga'
pkgNameSuffix = "all.ninemanga"
extClass = '.NineMangaEs; .NineMangaBr; .NineMangaEn; .NineMangaRu; .NineMangaDe; .NineMangaIt; .NineMangaFr'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
}

View File

@ -25,14 +25,14 @@ open class NineManga(override val name: String, override val baseUrl: String, ov
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/list/New-Update/", headers) // "$baseUrl/category/updated_$page.html"
override fun latestUpdatesSelector() = "ul.direlist > li"
override fun latestUpdatesSelector() = "dl.bookinfo"
override fun latestUpdatesFromElement(element: Element) = SManga.create().apply {
element.select("dl.bookinfo").let {
setUrlWithoutDomain(it.select("dd > a.bookname").attr("href") + "?waring=1") // To removes warning message and shows chapter list.
title = it.select("dd > a.bookname").first().text()
thumbnail_url = it.select("dt > a > img").attr("src")
element.select("a.bookname").let {
url = it.attr("href").substringAfter(baseUrl)
title = it.text()
}
thumbnail_url = element.select("img").attr("abs:src")
}
override fun latestUpdatesNextPageSelector() = "ul.pageList > li:last-child > a.l"
@ -47,14 +47,12 @@ open class NineManga(override val name: String, override val baseUrl: String, ov
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
document.select("div.bookintro").let {
thumbnail_url = document.select("a.bookface > img").attr("src")
genre = document.select("li[itemprop=genre] > a").joinToString(", ") {
it.text()
}
author = it.select("a[itemprop=author]").text()
artist = ""
description = it.select("p[itemprop=description]").text().orEmpty()
status = parseStatus(it.select("a.red").first().text().orEmpty())
title = it.select("li > span:not([class])").text()
genre = it.select("li[itemprop=genre] a").joinToString { e -> e.text() }
author = it.select("li a[itemprop=author]").text()
status = parseStatus(it.select("li a.red").first().text())
description = it.select("p[itemprop=description]").text()
thumbnail_url = it.select("img[itemprop=image]").attr("abs:src")
}
}
@ -64,12 +62,16 @@ open class NineManga(override val name: String, override val baseUrl: String, ov
else -> SManga.UNKNOWN
}
override fun chapterListRequest(manga: SManga): Request {
return GET(baseUrl + manga.url + "?waring=1", headers) // Bypasses adult content warning
}
override fun chapterListSelector() = "ul.sub_vol_ul > li"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
element.select("a.chapter_list_a").let {
name = it.text()
setUrlWithoutDomain(it.attr("href"))
url = it.attr("href").substringAfter(baseUrl).replace("%20", " ")
}
date_upload = parseChapterDate(element.select("span").text())
}

View File

@ -2,7 +2,9 @@ package eu.kanade.tachiyomi.extension.all.ninemanga
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.Request
import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.*
@ -26,6 +28,11 @@ fun getAllNineManga(): List<Source> {
class NineMangaEn : NineManga("NineMangaEn", "http://en.ninemanga.com", "en")
class NineMangaEs : NineManga("NineMangaEs", "http://es.ninemanga.com", "es") {
// ES, FR, RU don't return results for searches with an apostrophe
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return super.searchMangaRequest(page, query.substringBefore("\'"), filters)
}
override fun parseStatus(status: String) = when {
status.contains("En curso") -> SManga.ONGOING
status.contains("Completado") -> SManga.COMPLETED
@ -248,6 +255,11 @@ class NineMangaBr : NineManga("NineMangaBr", "http://br.ninemanga.com", "pt") {
}
class NineMangaRu : NineManga("NineMangaRu", "http://ru.ninemanga.com", "ru") {
// ES, FR, RU don't return results for searches with an apostrophe
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return super.searchMangaRequest(page, query.substringBefore("\'"), filters)
}
override fun parseStatus(status: String) = when {
// No Ongoing status
status.contains("завершенный") -> SManga.COMPLETED
@ -430,6 +442,11 @@ class NineMangaIt : NineManga("NineMangaIt", "http://it.ninemanga.com", "it") {
}
class NineMangaFr : NineManga("NineMangaFr", "http://fr.ninemanga.com", "fr") {
// ES, FR, RU don't return results for searches with an apostrophe
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return super.searchMangaRequest(page, query.substringBefore("\'"), filters)
}
override fun parseStatus(status: String) = when {
status.contains("En cours") -> SManga.ONGOING
status.contains("Complété") -> SManga.COMPLETED