Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davvarrr committed Oct 15, 2023
1 parent b1d2d0a commit 9b4153a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,20 @@ internal class FlixScans(context: MangaLoaderContext) : PagedMangaParser(context
val json = JSONArray(doc.requireElementById("__NUXT_DATA__").data())
val chapterData = json.getJSONObject(6).getInt("chapterData")
val pageLocate = json.getJSONObject(chapterData).getInt("webtoon")
val pages = json.getJSONArray(pageLocate).toString().replace("[", "").replace("]", "").split(",")
return pages.map {
val id = it.toInt()
val jsonPages = json.getJSONArray(pageLocate)
val pages = ArrayList<MangaPage>(jsonPages.length())
for (i in 0 until jsonPages.length()) {
val id = jsonPages.getInt(i)
val url = "https://api.$domain/storage/" + json.getString(id)
pages.add(
MangaPage(
id = generateUid(url),
url = url,
preview = null,
source = source,
)
)
}
return pages
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
append(page)
}
val json = webClient.httpGet(url).parseJsonArray()

return json.mapJSON { j ->
val urlManga = "https://$domain/api/get/card/${j.getString("manga_slug")}"
val img = "https://$domain/upload/min_cover/${j.getString("manga_image")}"
Expand All @@ -120,7 +119,7 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
override suspend fun getDetails(manga: Manga): Manga {
val json = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseJson()
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)
val slug = manga.url.substringAfterLast("/")
val dateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.FRANCE)
return manga.copy(
Expand All @@ -138,8 +137,7 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
val url = "https://$domain/api/get/chapter/$slug/$id"
val date = getDateString(
it.substringAfter("\"date\":\"").substringBefore("\",").toLong(),
) // Possible improvement here

)
MangaChapter(
id = generateUid(url),
name = "Chapitre : $id",
Expand All @@ -160,20 +158,22 @@ internal class LugnicaScans(context: MangaLoaderContext) : PagedMangaParser(cont
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
val fullUrl = chapter.url.toAbsoluteUrl(domain)
val jsonPage = webClient.httpGet(fullUrl).parseJson()
val idManga = jsonPage.getJSONObject("manga").getString("id")
val slugChapter = chapter.url.substringAfterLast("/")
val pages = jsonPage.getJSONObject("chapter").getJSONArray("files").toString()
.replace("[", "").replace("]", "").replace("\"", "")
.split(",") // Possible improvement here
return pages.map { img ->
val url = "https://$domain/upload/chapitre/$idManga/$slugChapter/$img"
MangaPage(
id = generateUid(url),
url = url,
preview = null,
source = source,
val idManga = jsonPage.getJSONObject("manga").getInt("id")
val slug = jsonPage.getJSONObject("chapter").getInt("chapter")
val jsonPages = jsonPage.getJSONObject("chapter").getJSONArray("files")
val pages = ArrayList<MangaPage>(jsonPages.length())
for (i in 0 until jsonPages.length()) {
val url = "https://$domain/upload/chapters/$idManga/$slug/${jsonPages.getString(i)}"
pages.add(
MangaPage(
id = generateUid(url),
url = url,
preview = null,
source = source,
),
)
}
return pages
}

override suspend fun getTags(): Set<MangaTag> = emptySet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ internal class ScansMangasMe(context: MangaLoaderContext) :

val pages = ArrayList<MangaPage>(images.length())
for (i in 0 until images.length()) {

val pageTake = images.getJSONObject(i)
pages.add(
MangaPage(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.koitharu.kotatsu.parsers.site.madara.pt

import org.koitharu.kotatsu.parsers.MangaLoaderContext
import org.koitharu.kotatsu.parsers.MangaSourceParser
import org.koitharu.kotatsu.parsers.model.MangaSource
import org.koitharu.kotatsu.parsers.site.madara.MadaraParser

@MangaSourceParser("LIMBOSCAN", "Limbo Scan", "pt")
internal class LimboScan(context: MangaLoaderContext) :
MadaraParser(context, MangaSource.LIMBOSCAN, "limboscan.com.br") {
override val tagPrefix = "obras-genre/"
override val listUrl= "obras/"
override val datePattern: String = "dd/MM/yyyy"
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ internal abstract class OtakuSanctuaryParser(
}


@Suppress("NAME_SHADOWING")
private fun processUrl(url: String, vi: String = ""): String {
var url = url.replace("_h_", "http")
.replace("_e_", "/extendContent/Manga")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ class YugenMangas(context: MangaLoaderContext) : PagedMangaParser(context, Manga

override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
val fullUrl = chapter.url.toAbsoluteUrl(domain)
val urlApi = fullUrl.replace("/series/", "/api/serie/").replace("/capitulo", "/chapter/capitulo") + "images/"
val json = webClient.httpGet(urlApi).parseJson().getJSONArray("chapter_images")
val apiUrl = webClient.httpGet(fullUrl).parseHtml().selectFirstOrThrow("script:containsData(imageUrls)").data()
.substringAfter("apiUrl = \"").substringBefore("\";")
val json = webClient.httpGet(apiUrl.toAbsoluteUrl(domain)).parseJson().getJSONArray("chapter_images")
val pages = ArrayList<MangaPage>(json.length())
for (i in 0 until json.length()) {
val img = "https://media.$domain/${json.getString(i)}"
Expand Down

0 comments on commit 9b4153a

Please sign in to comment.