Bakai: Fix thumbnail url (#4120)

* Fix image url

* Update icons

* Use toHttpUrl

* Remove toHttpUrl uneeded

* Replace icons
This commit is contained in:
Chopper 2024-07-22 04:23:31 -03:00 committed by Draff
parent 14c5eec0de
commit 0cda850385
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
7 changed files with 14 additions and 5 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Bakai' extName = 'Bakai'
extClass = '.Bakai' extClass = '.Bakai'
extVersionCode = 3 extVersionCode = 4
isNsfw = true isNsfw = true
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -59,7 +59,7 @@ class Bakai : ParsedHttpSource() {
override fun popularMangaSelector() = "#elCmsPageWrap ul > li > article" override fun popularMangaSelector() = "#elCmsPageWrap ul > li > article"
override fun popularMangaFromElement(element: Element) = SManga.create().apply { override fun popularMangaFromElement(element: Element) = SManga.create().apply {
thumbnail_url = element.selectFirst("img")?.absUrl("src") thumbnail_url = element.selectFirst("img")?.imgAttr()
with(element.selectFirst("h2.ipsType_pageTitle a")!!) { with(element.selectFirst("h2.ipsType_pageTitle a")!!) {
title = text() title = text()
setUrlWithoutDomain(attr("href")) setUrlWithoutDomain(attr("href"))
@ -117,7 +117,7 @@ class Bakai : ParsedHttpSource() {
override fun searchMangaSelector() = "ol > li > div" override fun searchMangaSelector() = "ol > li > div"
override fun searchMangaFromElement(element: Element) = SManga.create().apply { override fun searchMangaFromElement(element: Element) = SManga.create().apply {
thumbnail_url = element.selectFirst(".ipsThumb img")?.absUrl("src") thumbnail_url = element.selectFirst(".ipsThumb img")?.imgAttr()
with(element.selectFirst("h2.ipsStreamItem_title a")!!) { with(element.selectFirst("h2.ipsStreamItem_title a")!!) {
title = text() title = text()
@ -130,7 +130,7 @@ class Bakai : ParsedHttpSource() {
// =========================== Manga Details ============================ // =========================== Manga Details ============================
override fun mangaDetailsParse(document: Document) = SManga.create().apply { override fun mangaDetailsParse(document: Document) = SManga.create().apply {
title = document.selectFirst("h1.ipsType_pageTitle")?.text() ?: "Hentai" title = document.selectFirst("h1.ipsType_pageTitle")?.text() ?: "Hentai"
thumbnail_url = document.selectFirst("div.cCmsRecord_image img")?.absUrl("src") thumbnail_url = document.selectFirst("div.cCmsRecord_image img")?.imgAttr()
artist = document.selectFirst("span.mangaInfo:has(strong:contains(Artist)) + a")?.text() artist = document.selectFirst("span.mangaInfo:has(strong:contains(Artist)) + a")?.text()
genre = document.selectFirst("span.mangaInfo:has(strong:contains(Tags)) + span")?.text() genre = document.selectFirst("span.mangaInfo:has(strong:contains(Tags)) + span")?.text()
description = document.selectFirst("h2.ipsFieldRow_desc")?.let { description = document.selectFirst("h2.ipsFieldRow_desc")?.let {
@ -164,7 +164,7 @@ class Bakai : ParsedHttpSource() {
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
return document.select("div.ipsGrid div.ipsType_center > img") return document.select("div.ipsGrid div.ipsType_center > img")
.mapIndexed { index, item -> .mapIndexed { index, item ->
Page(index, "", item.absUrl("data-src")) Page(index, "", item.imgAttr())
} }
} }
@ -172,6 +172,15 @@ class Bakai : ParsedHttpSource() {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
private fun Element.imgAttr(): String {
return when {
hasAttr("data-lazy-src") -> attr("abs:data-lazy-src")
hasAttr("data-src") -> attr("abs:data-src")
hasAttr("data-cfsrc") -> attr("abs:data-cfsrc")
else -> attr("abs:src")
}
}
companion object { companion object {
const val PREFIX_SEARCH = "id:" const val PREFIX_SEARCH = "id:"
} }