Manga18fx: fix parsing (#13118)

This commit is contained in:
stevenyomi 2022-08-21 10:44:26 +08:00 committed by GitHub
parent 6d452d1709
commit 723100f16a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,72 @@
package eu.kanade.tachiyomi.extension.en.manga18fx
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Response
import org.jsoup.nodes.Element
import org.jsoup.select.Evaluator
import java.text.SimpleDateFormat
import java.util.Locale
class Manga18fx : Madara(
"Manga18fx",
"https://manga18fx.com",
"en",
SimpleDateFormat("dd MMM yy", Locale.ENGLISH)
) {
override val id = 3157287889751723714
override val client = network.client
override val fetchGenres = false
override val sendViewCount = false
override fun popularMangaRequest(page: Int) = GET(baseUrl, headers)
override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
val block = document.selectFirst(Evaluator.Class("trending-block"))
val mangas = block.select(Evaluator.Tag("a")).map(::mangaFromElement)
return MangasPage(mangas, false)
}
private fun mangaFromElement(element: Element) = SManga.create().apply {
url = element.attr("href")
title = element.attr("title")
thumbnail_url = element.selectFirst(Evaluator.Tag("img")).attr("data-src")
}
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/page/$page", headers)
override fun latestUpdatesParse(response: Response): MangasPage {
val document = response.asJsoup()
val mangas = document.select(Evaluator.Class("bsx-item")).map {
mangaFromElement(it.selectFirst(Evaluator.Tag("a")))
}
val nextButton = document.selectFirst(Evaluator.Class("next"))
val hasNextPage = nextButton != null && nextButton.hasClass("disabled").not()
return MangasPage(mangas, hasNextPage)
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
GET("$baseUrl/search?q=$query&page=$page", headers)
override fun searchMangaParse(response: Response) = latestUpdatesParse(response)
override val mangaDetailsSelectorDescription = ".dsct"
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val container = document.selectFirst(Evaluator.Class("row-content-chapter"))
return container.children().map(::chapterFromElement)
}
override fun chapterDateSelector() = "span.chapter-time"
override fun getFilterList() = FilterList(emptyList())
}

View File

@ -222,7 +222,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Manga-Online.co", "https://www.manga-online.co", "th", className = "MangaOnlineCo"),
SingleLang("Manga-Scantrad", "https://manga-scantrad.net", "fr", className = "MangaScantrad", overrideVersionCode = 2),
SingleLang("Manga-TX", "https://manga-tx.com", "en", className = "Mangatxunoriginal"),
SingleLang("Manga18 Fx", "https://manga18fx.com", "en", overrideVersionCode = 1),
SingleLang("Manga18fx", "https://manga18fx.com", "en", isNsfw = true, overrideVersionCode = 2),
SingleLang("Manga1st", "https://manga1st.com", "en", overrideVersionCode = 2),
SingleLang("Manga1st.online", "https://manga1st.online", "en", className = "MangaFirstOnline", overrideVersionCode = 1),
SingleLang("Manga347", "https://manga347.com", "en", overrideVersionCode = 3),