WPMangaReader: update image extractor regex (#12389)
MangKomik was also changed to fetch the external script containing the image URLs. This might be later moved to WPMangaReader, but the selector would require some more testing as it might catch false positives.
This commit is contained in:
parent
ada3d40bee
commit
3f57c7f4c8
|
@ -1,7 +1,27 @@
|
||||||
package eu.kanade.tachiyomi.extension.id.mangkomik
|
package eu.kanade.tachiyomi.extension.id.mangkomik
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
|
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
|
||||||
class MangKomik : WPMangaReader("MangKomik", "https://mangkomik.com", "id") {
|
class MangKomik : WPMangaReader("MangKomik", "https://mangkomik.com", "id") {
|
||||||
override val hasProjectPage = true
|
override val hasProjectPage = true
|
||||||
|
|
||||||
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
// Get external JS for image urls
|
||||||
|
val scriptEl = document.selectFirst("script[data-minify]")
|
||||||
|
val scriptUrl = scriptEl?.attr("src")
|
||||||
|
if (scriptUrl.isNullOrEmpty()) {
|
||||||
|
return super.pageListParse(document)
|
||||||
|
}
|
||||||
|
|
||||||
|
val scriptResponse = client.newCall(
|
||||||
|
GET(scriptUrl, headers)
|
||||||
|
).execute()
|
||||||
|
|
||||||
|
// Inject external JS
|
||||||
|
scriptEl.text(scriptResponse.body!!.string())
|
||||||
|
return super.pageListParse(document)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,11 +246,11 @@ abstract class WPMangaReader(
|
||||||
|
|
||||||
countViews(document)
|
countViews(document)
|
||||||
|
|
||||||
// Some sites like mangakita now load pages via javascript
|
// Some sites like Mangakita, MangKomik now load pages via javascript
|
||||||
if (pages.isNotEmpty()) { return pages }
|
if (pages.isNotEmpty()) { return pages }
|
||||||
|
|
||||||
val docString = document.toString()
|
val docString = document.toString()
|
||||||
val imageListRegex = Regex("\\\"images.*?:.*?(\\[.*?\\])")
|
val imageListRegex = Regex("\\\"images\\\"\\s*:\\s*(\\[.*?\\])")
|
||||||
val imageListJson = imageListRegex.find(docString)!!.destructured.toList()[0]
|
val imageListJson = imageListRegex.find(docString)!!.destructured.toList()[0]
|
||||||
|
|
||||||
val imageList = json.parseToJsonElement(imageListJson).jsonArray
|
val imageList = json.parseToJsonElement(imageListJson).jsonArray
|
||||||
|
|
|
@ -10,7 +10,7 @@ class WPMangaReaderGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val themeClass = "WPMangaReader"
|
override val themeClass = "WPMangaReader"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 13
|
override val baseVersionCode: Int = 14
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Flame Scans", "https://flamescans.org", listOf("ar", "en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 1),
|
MultiLang("Flame Scans", "https://flamescans.org", listOf("ar", "en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 1),
|
||||||
|
|
Loading…
Reference in New Issue