Fixes MangaPill (#9680)

This commit is contained in:
ringosham 2021-11-01 11:31:04 +00:00 committed by GitHub
parent fc27f99a48
commit 027fd3ce2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 22 deletions

View File

@ -5,7 +5,8 @@ ext {
extName = 'MangaPill' extName = 'MangaPill'
pkgNameSuffix = 'en.mangapill' pkgNameSuffix = 'en.mangapill'
extClass = '.MangaPill' extClass = '.MangaPill'
extVersionCode = 5 extVersionCode = 6
isNsfw = true
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -22,40 +22,37 @@ class MangaPill : ParsedHttpSource() {
override val supportsLatest = true override val supportsLatest = true
override val client: OkHttpClient = network.cloudflareClient override val client: OkHttpClient = network.cloudflareClient
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request = latestUpdatesRequest(page)
return GET("$baseUrl/search?q=&type=&status=&page=$page", headers)
}
override fun latestUpdatesRequest(page: Int): Request { override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/chapters", headers) return GET("$baseUrl/chapters", headers)
} }
override fun popularMangaSelector() = ".grid.justify-between.gap-3.grid-cols-2 > div" override fun popularMangaSelector() = latestUpdatesSelector()
override fun latestUpdatesSelector() = ".flex.bg-color-bg-secondary.p-2.rounded" override fun latestUpdatesSelector() = ".flex.bg-card.p-2.rounded"
override fun searchMangaSelector() = popularMangaSelector() override fun searchMangaSelector() = ".my-3.grid.justify-between.gap-3.grid-cols-2 > div"
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga = latestUpdatesFromElement(element)
val manga = SManga.create()
manga.thumbnail_url = element.select("img").attr("data-src")
manga.setUrlWithoutDomain(element.select("a").first().attr("href"))
manga.title = element.select(".mt-2 a").text()
return manga
}
override fun latestUpdatesFromElement(element: Element): SManga { override fun latestUpdatesFromElement(element: Element): SManga {
val manga = SManga.create() val manga = SManga.create()
manga.thumbnail_url = element.select("img").attr("data-src") manga.thumbnail_url = element.select("img").attr("data-src")
val url = element.select("a").first().attr("href") val url = element.select("a").first().attr("href")
manga.setUrlWithoutDomain(url.substringBeforeLast("/").replace("chapters", "manga").substringBeforeLast("-") + "/" + url.substringAfterLast("/").substringBefore("-chapter")) manga.setUrlWithoutDomain(url.substringBeforeLast("/").replace("chapters", "manga").substringBeforeLast("-") + "/" + url.substringAfterLast("/").substringBefore("-chapter"))
manga.title = element.select(".inilne.block").text().trim() manga.title = element.select("a > div:first-child").text().trim()
return manga return manga
} }
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) override fun searchMangaFromElement(element: Element) = SManga.create().apply {
thumbnail_url = element.select("img").attr("data-src")
url = element.select("a").first().attr("href")
setUrlWithoutDomain(url.substringBeforeLast("/").replace("chapters", "manga").substringBeforeLast("-") + "/" + url.substringAfterLast("/").substringBefore("-chapter"))
title = element.select("div > a").text().trim()
}
override fun popularMangaNextPageSelector() = "a.next.page-numbers" override fun popularMangaNextPageSelector() = null
override fun latestUpdatesNextPageSelector() = null override fun latestUpdatesNextPageSelector() = null
override fun searchMangaNextPageSelector() = "a.btn:contains(Next)" override fun searchMangaNextPageSelector() = "a.btn.btn-sm"
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create() val manga = SManga.create()
@ -67,9 +64,9 @@ class MangaPill : ParsedHttpSource() {
genres.add(genre) genres.add(genre)
} }
manga.genre = genres.joinToString(", ") manga.genre = genres.joinToString(", ")
manga.status = parseStatus(document.select("label:contains(Status) + div").text()) manga.status = parseStatus(document.select("div.container > div:first-child > div:last-child > div:nth-child(3) > div:nth-child(2) > div").text())
manga.description = document.select("p.text-sm.text-color-text-secondary").text() manga.description = document.select("div.container > div:first-child > div:last-child > div:nth-child(2) > p").text()
manga.thumbnail_url = document.select(".object-cover").first().attr("data-src") manga.thumbnail_url = document.select("div.container > div:first-child > div:first-child > img").first().attr("data-src")
return manga return manga
} }
@ -81,7 +78,7 @@ class MangaPill : ParsedHttpSource() {
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
override fun chapterListSelector() = "a.border.border-color-border-primary.p-1" override fun chapterListSelector() = "#chapters > div > a"
override fun chapterFromElement(element: Element): SChapter { override fun chapterFromElement(element: Element): SChapter {
val urlElement = element.attr("href") val urlElement = element.attr("href")