Fix GabutScans Broken Images (#12279)

* fix broken image

* refactor and fix chapter image broken

* Apply suggestions

Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>

* remove `pages`

Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
Masga 2022-06-24 09:25:19 +07:00 committed by GitHub
parent 281fc6123c
commit 1e13faa490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,11 @@
package eu.kanade.tachiyomi.extension.id.gabutscans package eu.kanade.tachiyomi.extension.id.gabutscans
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
import eu.kanade.tachiyomi.source.model.Page
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonPrimitive
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -10,4 +15,29 @@ class GabutScans : WPMangaReader(
) { ) {
override val hasProjectPage = true override val hasProjectPage = true
override fun searchMangaFromElement(element: Element) =
super.searchMangaFromElement(element).apply {
thumbnail_url = element.select("img").attr("abs:data-src")
}
override fun mangaDetailsParse(document: Document) = super.mangaDetailsParse(document).apply {
thumbnail_url = document.select(seriesThumbnailSelector).attr("abs:data-src")
}
override fun pageListParse(document: Document): List<Page> {
// Prefer using sources loaded from javascript
// because current CDN (Statically) can't load old images.
// Example: https://gabutscans.com/cinderella-wa-sagasanai-chapter-41-end-bahasa-indonesia/
val docString = document.toString()
val imageListRegex = Regex("""\"images.*?:.*?(\[.*?])""")
val (imageListJson) = imageListRegex.find(docString)!!.destructured
val imageList = json.parseToJsonElement(imageListJson).jsonArray
return imageList.mapIndexed { i, jsonEl ->
Page(i, "", jsonEl.jsonPrimitive.content)
}
}
} }

View File

@ -22,7 +22,7 @@ class WPMangaReaderGenerator : ThemeSourceGenerator {
SingleLang("BeastScans", "https://beastscans.com", "en"), SingleLang("BeastScans", "https://beastscans.com", "en"),
SingleLang("Franxx Mangás", "https://franxxmangas.net", "pt-BR", className = "FranxxMangas", isNsfw = true), SingleLang("Franxx Mangás", "https://franxxmangas.net", "pt-BR", className = "FranxxMangas", isNsfw = true),
SingleLang("Fusion Scanlation", "https://fusionscanlation.com", "es", className = "FusionScanlation", overrideVersionCode = 2), SingleLang("Fusion Scanlation", "https://fusionscanlation.com", "es", className = "FusionScanlation", overrideVersionCode = 2),
SingleLang("Gabut Scans", "https://gabutscans.com", "id"), SingleLang("Gabut Scans", "https://gabutscans.com", "id", overrideVersionCode = 1),
SingleLang("Gecenin Lordu", "https://geceninlordu.com", "tr", overrideVersionCode = 1), SingleLang("Gecenin Lordu", "https://geceninlordu.com", "tr", overrideVersionCode = 1),
SingleLang("InariManga", "https://inarimanga.com", "es"), SingleLang("InariManga", "https://inarimanga.com", "es"),
SingleLang("Kiryuu", "https://kiryuu.id", "id", overrideVersionCode = 6), SingleLang("Kiryuu", "https://kiryuu.id", "id", overrideVersionCode = 6),