|
|
|
@ -9,6 +9,7 @@ import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
import org.koitharu.kotatsu.parsers.network.UserAgents
|
|
|
|
import org.koitharu.kotatsu.parsers.network.UserAgents
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
|
|
|
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
|
|
|
|
|
|
|
import java.lang.IllegalArgumentException
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.util.*
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
|
|
@ -48,24 +49,19 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
|
|
|
|
tags: Set<MangaTag>?,
|
|
|
|
tags: Set<MangaTag>?,
|
|
|
|
sortOrder: SortOrder,
|
|
|
|
sortOrder: SortOrder,
|
|
|
|
): List<Manga> {
|
|
|
|
): List<Manga> {
|
|
|
|
|
|
|
|
|
|
|
|
if (!query.isNullOrEmpty()) {
|
|
|
|
if (!query.isNullOrEmpty()) {
|
|
|
|
return emptyList()
|
|
|
|
throw IllegalArgumentException("Search is not supported by this source")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (sortOrder == SortOrder.ALPHABETICAL) {
|
|
|
|
if (sortOrder == SortOrder.ALPHABETICAL) {
|
|
|
|
|
|
|
|
|
|
|
|
if (page > 1) {
|
|
|
|
if (page > 1) {
|
|
|
|
return emptyList()
|
|
|
|
return emptyList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val url = buildString {
|
|
|
|
val url = buildString {
|
|
|
|
append("https://")
|
|
|
|
append("https://")
|
|
|
|
append(domain)
|
|
|
|
append(domain)
|
|
|
|
append("/api/get/catalog?page=0&filter=all")
|
|
|
|
append("/api/get/catalog?page=0&filter=all")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val json = webClient.httpGet(url).parseJsonArray()
|
|
|
|
val json = webClient.httpGet(url).parseJsonArray()
|
|
|
|
|
|
|
|
|
|
|
|
return json.mapJSON { j ->
|
|
|
|
return json.mapJSON { j ->
|
|
|
|
val urlManga = "https://$domain/api/get/card/${j.getString("slug")}"
|
|
|
|
val urlManga = "https://$domain/api/get/card/${j.getString("slug")}"
|
|
|
|
val img = "https://$domain/upload/min_cover/${j.getString("image")}"
|
|
|
|
val img = "https://$domain/upload/min_cover/${j.getString("image")}"
|
|
|
|
@ -123,10 +119,8 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
|
|
|
|
|
|
|
|
|
|
|
|
override suspend fun getDetails(manga: Manga): Manga {
|
|
|
|
override suspend fun getDetails(manga: Manga): Manga {
|
|
|
|
val json = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseJson()
|
|
|
|
val json = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseJson()
|
|
|
|
|
|
|
|
|
|
|
|
val jsonManga = json.getJSONObject("manga")
|
|
|
|
val jsonManga = json.getJSONObject("manga")
|
|
|
|
val chapters = json.getJSONObject("chapters").toString().split("{\"id\":").drop(1) // Possible improvement here
|
|
|
|
val chapters = json.getJSONObject("chapters").toString().split("{\"id\":").drop(1) // Possible improvement here
|
|
|
|
|
|
|
|
|
|
|
|
val slug = manga.url.substringAfterLast("/")
|
|
|
|
val slug = manga.url.substringAfterLast("/")
|
|
|
|
val dateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.FRANCE)
|
|
|
|
val dateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.FRANCE)
|
|
|
|
return manga.copy(
|
|
|
|
return manga.copy(
|
|
|
|
@ -163,18 +157,14 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
|
|
|
|
private val simpleDateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.FRANCE)
|
|
|
|
private val simpleDateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.FRANCE)
|
|
|
|
private fun getDateString(time: Long): String = simpleDateFormat.format(time * 1000L)
|
|
|
|
private fun getDateString(time: Long): String = simpleDateFormat.format(time * 1000L)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.toAbsoluteUrl(domain)
|
|
|
|
val jsonPage = webClient.httpGet(fullUrl).parseJson()
|
|
|
|
val jsonPage = webClient.httpGet(fullUrl).parseJson()
|
|
|
|
|
|
|
|
|
|
|
|
val idManga = jsonPage.getJSONObject("manga").getString("id")
|
|
|
|
val idManga = jsonPage.getJSONObject("manga").getString("id")
|
|
|
|
val slugChapter = chapter.url.substringAfterLast("/")
|
|
|
|
val slugChapter = chapter.url.substringAfterLast("/")
|
|
|
|
|
|
|
|
|
|
|
|
val pages = jsonPage.getJSONObject("chapter").getJSONArray("files").toString()
|
|
|
|
val pages = jsonPage.getJSONObject("chapter").getJSONArray("files").toString()
|
|
|
|
.replace("[", "").replace("]", "").replace("\"", "")
|
|
|
|
.replace("[", "").replace("]", "").replace("\"", "")
|
|
|
|
.split(",") // Possible improvement here
|
|
|
|
.split(",") // Possible improvement here
|
|
|
|
|
|
|
|
|
|
|
|
return pages.map { img ->
|
|
|
|
return pages.map { img ->
|
|
|
|
val url = "https://$domain/upload/chapitre/$idManga/$slugChapter/$img"
|
|
|
|
val url = "https://$domain/upload/chapitre/$idManga/$slugChapter/$img"
|
|
|
|
MangaPage(
|
|
|
|
MangaPage(
|
|
|
|
|