fix Asura Scans

pull/232/head
devi 3 years ago
parent 896139a8ed
commit 2efdb1940a

@ -220,13 +220,13 @@ internal abstract class MangaReaderParser(
protected open val encodedSrc = false protected open val encodedSrc = false
protected open val selectScript = "div.wrapper script" protected open val selectScript = "div.wrapper script"
protected open val selectPage = "div#readerarea img" protected open val selectPage = "div#readerarea img"
protected open val selectTestScript = "script:containsData(ts_reader)"
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> { override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
val chapterUrl = chapter.url.toAbsoluteUrl(domain) val chapterUrl = chapter.url.toAbsoluteUrl(domain)
val docs = webClient.httpGet(chapterUrl).parseHtml() val docs = webClient.httpGet(chapterUrl).parseHtml()
val test = docs.select("script:containsData(ts_reader)") val test = docs.select(selectTestScript)
if (test.isNullOrEmpty() and !encodedSrc) { if (test.isNullOrEmpty() and !encodedSrc) {
return docs.select(selectPage).map { img -> return docs.select(selectPage).map { img ->
val url = img.src()?.toRelativeUrl(domain) ?: img.parseFailed("Image src not found") val url = img.src()?.toRelativeUrl(domain) ?: img.parseFailed("Image src not found")
@ -257,7 +257,7 @@ internal abstract class MangaReaderParser(
.getJSONArray("images") .getJSONArray("images")
} else { } else {
val script = docs.selectFirstOrThrow("script:containsData(ts_reader)") val script = docs.selectFirstOrThrow(selectTestScript)
JSONObject(script.data().substringAfter('(').substringBeforeLast(')')) JSONObject(script.data().substringAfter('(').substringBeforeLast(')'))
.getJSONArray("sources") .getJSONArray("sources")
.getJSONObject(0) .getJSONObject(0)

@ -7,7 +7,11 @@ import org.koitharu.kotatsu.parsers.site.mangareader.MangaReaderParser
@MangaSourceParser("ASURASCANS", "Asura Scans", "en") @MangaSourceParser("ASURASCANS", "Asura Scans", "en")
internal class AsuraScansParser(context: MangaLoaderContext) : internal class AsuraScansParser(context: MangaLoaderContext) :
MangaReaderParser(context, MangaSource.ASURASCANS, "asura.gg", pageSize = 20, searchPageSize = 10) { MangaReaderParser(context, MangaSource.ASURASCANS, "asura.nacm.xyz", pageSize = 20, searchPageSize = 10) {
override val datePattern = "MMM d, yyyy" override val datePattern = "MMM d, yyyy"
override val selectPage = "div#readerarea p img"
// A little dummy text to avoid importing the whole getpage part
override val selectTestScript = "Force to parse html"
} }

Loading…
Cancel
Save