Yugen Mangás: Update domain and fix pagelist (#3736)
* Update domain and fix pagelist * minor change * minor change
This commit is contained in:
parent
c8825e0bc4
commit
445ce09211
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'Yugen Mangás'
|
||||
extClass = '.YugenMangas'
|
||||
extVersionCode = 39
|
||||
extVersionCode = 40
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
@ -29,7 +28,7 @@ class YugenMangas : HttpSource() {
|
||||
|
||||
override val name = "Yugen Mangás"
|
||||
|
||||
override val baseUrl = "https://yugenmangas.net.br"
|
||||
override val baseUrl = "https://yugenapp.lat"
|
||||
|
||||
override val lang = "pt-BR"
|
||||
|
||||
@ -103,6 +102,13 @@ class YugenMangas : HttpSource() {
|
||||
return POST("$API_BASE_URL/chapters/get_chapters_by_serie/", newHeaders, payload)
|
||||
}
|
||||
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
val slug = chapter.url.removePrefix("/series/").substringBefore("/")
|
||||
val chapterSlug = chapter.url.substringAfterLast("/")
|
||||
|
||||
return POST("$API_BASE_URL/serie/$slug/chapter/$chapterSlug/images/imgs/get/", apiHeaders)
|
||||
}
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val (seriesSlug) = response.request.body!!.parseAs<YugenGetChaptersBySeriesDto>()
|
||||
|
||||
@ -114,12 +120,9 @@ class YugenMangas : HttpSource() {
|
||||
override fun getChapterUrl(chapter: SChapter) = baseUrl + chapter.url
|
||||
|
||||
override fun pageListParse(response: Response): List<Page> {
|
||||
val json = response.asJsoup().selectFirst("script#__NUXT_DATA__")!!.data()
|
||||
return CHAPTER_PAGES_REGEX.findAll(json)
|
||||
.mapIndexed { index, image ->
|
||||
Page(index, baseUrl, "$API_HOST/${image.value}")
|
||||
}
|
||||
.toList()
|
||||
val result = response.parseAs<YugenPageList>()
|
||||
|
||||
return result.chapterImages.mapIndexed { index, url -> Page(index, baseUrl, "$API_HOST/$url") }
|
||||
}
|
||||
|
||||
override fun imageUrlParse(response: Response) = ""
|
||||
@ -142,9 +145,8 @@ class YugenMangas : HttpSource() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val API_HOST = "https://api.yugenmangas.net.br"
|
||||
private const val API_HOST = "https://api.yugenapp.lat"
|
||||
private const val API_BASE_URL = "$API_HOST/api"
|
||||
private val CHAPTER_PAGES_REGEX = """(media/series[^"]+)""".toRegex()
|
||||
private val JSON_MEDIA_TYPE = "application/json".toMediaType()
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
@Serializable
|
||||
data class YugenMangaDto(
|
||||
class YugenMangaDto(
|
||||
val name: String,
|
||||
@JsonNames("capa", "cover") val cover: String,
|
||||
val slug: String,
|
||||
@ -42,10 +42,10 @@ data class YugenMangaDto(
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class YugenChapterListDto(val chapters: List<YugenChapterDto>)
|
||||
class YugenChapterListDto(val chapters: List<YugenChapterDto>)
|
||||
|
||||
@Serializable
|
||||
data class YugenChapterDto(
|
||||
class YugenChapterDto(
|
||||
val name: String,
|
||||
val season: Int,
|
||||
@SerialName("upload_date") val uploadDate: String,
|
||||
@ -76,3 +76,8 @@ data class YugenChapterDto(
|
||||
data class YugenGetChaptersBySeriesDto(
|
||||
@SerialName("serie_slug") val seriesSlug: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
class YugenPageList(
|
||||
@SerialName("chapter_images") val chapterImages: List<String>,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user