Manga-Raw.club: Improvements (#11607)
This commit is contained in:
parent
322cfa9bde
commit
033168afb8
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'manga-raw.club'
|
||||
pkgNameSuffix = 'en.mangarawclub'
|
||||
extClass = '.MangaRawClub'
|
||||
extVersionCode = 10
|
||||
extVersionCode = 11
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
package eu.kanade.tachiyomi.extension.en.mangarawclub
|
||||
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import rx.Observable
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -66,24 +62,25 @@ class MangaRawClub : ParsedHttpSource() {
|
|||
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
|
||||
|
||||
override fun mangaDetailsParse(document: Document): SManga {
|
||||
if (document.select(".novel-header").first() == null)
|
||||
throw Exception("Page not found")
|
||||
|
||||
val manga = SManga.create()
|
||||
val author = document.select(".author a").first()?.attr("title") ?: ""
|
||||
manga.author = if (author != "Updating") author else null
|
||||
val author = document.select(".author a").first()?.attr("title")?.trim() ?: ""
|
||||
if (author.toLowerCase(Locale.ROOT) != "updating")
|
||||
manga.author = author
|
||||
|
||||
var description = document.select(".description").first()?.text() ?: ""
|
||||
description = description.substringAfter("The Summary is").trim()
|
||||
|
||||
val otherTitle = document.select(".alternative-title").first()?.text() ?: ""
|
||||
if (otherTitle != "Updating")
|
||||
val otherTitle = document.select(".alternative-title").first()?.text()?.trim() ?: ""
|
||||
if (otherTitle.isNotEmpty() && otherTitle.toLowerCase(Locale.ROOT) != "updating")
|
||||
description += "\n\n$altName $otherTitle"
|
||||
manga.description = description.trim()
|
||||
|
||||
val genres = mutableListOf<String>()
|
||||
document.select(".categories a[href*=genre]").forEach { element ->
|
||||
val genre = element.attr("title").removeSuffix("Genre").trim()
|
||||
genres.add(genre)
|
||||
manga.genre = document.select(".categories a[href*=genre]").joinToString(", ") {
|
||||
it.attr("title").removeSuffix("Genre").trim()
|
||||
}
|
||||
manga.genre = genres.joinToString(", ")
|
||||
|
||||
val statusElement = document.select("div.header-stats")
|
||||
manga.status = when {
|
||||
|
@ -103,7 +100,7 @@ class MangaRawClub : ParsedHttpSource() {
|
|||
override fun chapterListSelector() = "ul.chapter-list > li"
|
||||
|
||||
override fun chapterListRequest(manga: SManga): Request {
|
||||
val url = baseUrl + manga.url + "all-chapters"
|
||||
val url = baseUrl + manga.url + "all-chapters/"
|
||||
return GET(url, headers)
|
||||
}
|
||||
|
||||
|
@ -145,19 +142,6 @@ class MangaRawClub : ParsedHttpSource() {
|
|||
|
||||
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used.")
|
||||
|
||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||
val request = searchMangaRequest(page, query, filters)
|
||||
return client.newCall(request).asObservableSuccess().map { response ->
|
||||
val mangas = mutableListOf<SManga>()
|
||||
val document = response.asJsoup()
|
||||
document.select(searchMangaSelector()).forEach { element ->
|
||||
mangas.add(searchMangaFromElement(element))
|
||||
}
|
||||
val nextPage = document.select(searchMangaNextPageSelector()).isNotEmpty()
|
||||
MangasPage(mangas, nextPage)
|
||||
}
|
||||
}
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
if (query.isNotEmpty()) // Query search
|
||||
return GET("$baseUrl/search/?search=$query", headers)
|
||||
|
|
Loading…
Reference in New Issue