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