MangaFast: fix latest, browse, manga detail, chapter list (#6248)

This commit is contained in:
Riztard Lanthorn 2021-03-22 23:41:13 +07:00 committed by GitHub
parent 1af08ae1aa
commit 9a24033f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 19 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaFast'
pkgNameSuffix = 'en.mangafast'
extClass = '.MangaFast'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
}

View File

@ -6,6 +6,7 @@ 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 okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.ParseException
@ -21,30 +22,35 @@ class MangaFast : ParsedHttpSource() {
override val supportsLatest = true
override fun popularMangaRequest(page: Int) = GET("$baseUrl/list-manga/", headers)
// popular
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/list-manga" + if (page > 1) "/page/$page" else "", headers)
}
override fun popularMangaSelector() = "li.ranking1"
override fun popularMangaSelector() = ".daftar .bge"
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
title = element.select("h4").text().trim()
thumbnail_url = element.select("img").attr("src").substringBeforeLast("?resize")
setUrlWithoutDomain(element.select(".bgei a").attr("href"))
title = element.select(".kan h3").text().trim()
thumbnail_url = element.select(".bgei img").attr("src")
}
override fun popularMangaNextPageSelector(): String? = null
override fun popularMangaNextPageSelector() = ".btn-w a:contains(Next »)"
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/read/page/$page", headers)
// latest
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl", headers)
override fun latestUpdatesSelector() = "div.ls5"
override fun latestUpdatesSelector() = ".ls8w div.ls8"
override fun latestUpdatesFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
title = element.select("h3").text().trim()
thumbnail_url = element.select("img").attr("src").substringBeforeLast("?resize")
setUrlWithoutDomain(element.select(".ls8j a").attr("href"))
title = element.select("h4").text().trim()
thumbnail_url = element.select(".ls8v img").attr("src")
}
override fun latestUpdatesNextPageSelector() = "a.next"
override fun latestUpdatesNextPageSelector(): String? = null
// search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = GET("$baseUrl/page/$page/?s=$query", headers)
override fun searchMangaSelector() = latestUpdatesSelector()
@ -53,12 +59,14 @@ class MangaFast : ParsedHttpSource() {
override fun searchMangaNextPageSelector() = latestUpdatesNextPageSelector()
// manga details
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
title = document.select("#Judul h1").text()
author = document.select("td[itemprop=creator]").text().trim()
status = parseStatus(document.select(".inftable").text())
genre = document.select("a[itemprop=genre]").joinToString { it.text() }
description = document.select("[itemprop=description]").first().text().trim()
thumbnail_url = document.select("div.cvr > img").first().attr("src").substringBeforeLast("?resize")
description = document.select("#Judul .desc").first().text().substringAfter(title).substringAfter(". ")
thumbnail_url = document.select("#Informasi .row img.shadow").first().attr("src")
}
private fun parseStatus(status: String) = when {
@ -67,12 +75,13 @@ class MangaFast : ParsedHttpSource() {
else -> SManga.UNKNOWN
}
override fun chapterListSelector() = "tr:has(td.tgs:matches(\\d{4}-\\d{2}-\\d{2}))"
// chapter list
override fun chapterListSelector() = ".chapter-link"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
name = element.select("a").attr("title")
date_upload = parseDate(element.select("td.tgs").text())
name = element.select(".text-left").text()
date_upload = parseDate(element.select(".text-right").text())
}
private fun parseDate(text: String): Long {
@ -89,8 +98,9 @@ class MangaFast : ParsedHttpSource() {
}
}
// pages
override fun pageListParse(document: Document): List<Page> {
return document.select("div.chp2 > img").mapIndexed { i, element ->
return document.select(".content-comic > img").mapIndexed { i, element ->
var url = element.attr("abs:data-src")
if (url.isEmpty()) {