|
|
|
@ -4,6 +4,8 @@ import androidx.collection.ArraySet
|
|
|
|
import kotlinx.coroutines.async
|
|
|
|
import kotlinx.coroutines.async
|
|
|
|
import kotlinx.coroutines.awaitAll
|
|
|
|
import kotlinx.coroutines.awaitAll
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
|
|
|
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|
|
|
|
|
|
|
import org.json.JSONArray
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
@ -11,6 +13,7 @@ import org.koitharu.kotatsu.parsers.PagedMangaParser
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.util.*
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
|
|
@ -127,37 +130,55 @@ internal class KskMoe(context: MangaLoaderContext) : PagedMangaParser(context, M
|
|
|
|
)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
author = doc.requireElementById("metadata").selectFirstOrThrow("main div:contains(Artist) a span").text(),
|
|
|
|
author = doc.requireElementById("metadata").selectFirstOrThrow("main div:contains(Artist) a span").text(),
|
|
|
|
chapters =
|
|
|
|
chapters = listOf(
|
|
|
|
if ((doc.html().contains("previews"))) {
|
|
|
|
MangaChapter(
|
|
|
|
listOf(
|
|
|
|
id = generateUid(manga.id),
|
|
|
|
MangaChapter(
|
|
|
|
name = manga.title,
|
|
|
|
id = generateUid(manga.id),
|
|
|
|
number = 1,
|
|
|
|
name = manga.title,
|
|
|
|
url = manga.url,
|
|
|
|
number = 1,
|
|
|
|
scanlator = null,
|
|
|
|
url = manga.url,
|
|
|
|
uploadDate = date.tryParse(doc.selectFirstOrThrow("time.updated").text()),
|
|
|
|
scanlator = null,
|
|
|
|
branch = null,
|
|
|
|
uploadDate = date.tryParse(doc.selectFirstOrThrow("time.updated").text()),
|
|
|
|
source = source,
|
|
|
|
branch = null,
|
|
|
|
),
|
|
|
|
source = source,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
emptyList()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// For the moment the pages are in poor quality.
|
|
|
|
|
|
|
|
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
|
|
|
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
|
|
|
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
|
|
|
val fullUrl = chapter.url
|
|
|
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
|
|
|
.replace("/view/", "/read/")
|
|
|
|
return doc.requireElementById("previews").select("main div img").map { img ->
|
|
|
|
.let { "$it/1" }
|
|
|
|
val url = img.src() ?: img.parseFailed("Image src not found")
|
|
|
|
.toAbsoluteUrl(domain)
|
|
|
|
|
|
|
|
val document = webClient.httpGet(fullUrl).parseHtml()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val id = fullUrl
|
|
|
|
|
|
|
|
.substringAfter("/read/")
|
|
|
|
|
|
|
|
.substringBeforeLast("/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val cdnUrl = document.selectFirst("meta[itemprop=image]")
|
|
|
|
|
|
|
|
?.attr("content")
|
|
|
|
|
|
|
|
?.toHttpUrlOrNull()
|
|
|
|
|
|
|
|
?.host
|
|
|
|
|
|
|
|
.let { "https://" + (it ?: domain) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val script = document.select("script:containsData(window.metadata)").html()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val rawJson = script
|
|
|
|
|
|
|
|
.substringAfter("original:")
|
|
|
|
|
|
|
|
.substringBefore("resampled:")
|
|
|
|
|
|
|
|
.substringBeforeLast(",")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return JSONArray(rawJson).mapJSON {
|
|
|
|
|
|
|
|
val fileName = it.getString("n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val url = "$cdnUrl/original/$id/$fileName"
|
|
|
|
|
|
|
|
val preview = "$cdnUrl/t/$id/320/$fileName"
|
|
|
|
|
|
|
|
|
|
|
|
MangaPage(
|
|
|
|
MangaPage(
|
|
|
|
id = generateUid(url),
|
|
|
|
id = generateUid(url),
|
|
|
|
url = url,
|
|
|
|
url = url,
|
|
|
|
preview = null,
|
|
|
|
preview = preview,
|
|
|
|
source = source,
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|