IkigaiMangas: Fix http 404 when reading a chapter (#2511)
* fix pages * remove dto
This commit is contained in:
		
							parent
							
								
									ecb0606bb4
								
							
						
					
					
						commit
						d3a34b5693
					
				@ -1,7 +1,7 @@
 | 
			
		||||
ext {
 | 
			
		||||
    extName = 'Ikigai Mangas'
 | 
			
		||||
    extClass = '.IkigaiMangas'
 | 
			
		||||
    extVersionCode = 5
 | 
			
		||||
    extVersionCode = 6
 | 
			
		||||
    isNsfw = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ 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.json.Json
 | 
			
		||||
import okhttp3.HttpUrl.Companion.toHttpUrl
 | 
			
		||||
@ -141,14 +142,13 @@ class IkigaiMangas : HttpSource() {
 | 
			
		||||
        return mangas
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun pageListRequest(chapter: SChapter): Request {
 | 
			
		||||
        val id = chapter.url.substringAfter("/capitulo/")
 | 
			
		||||
        return GET("$apiBaseUrl/api/swf/chapters/$id", headers)
 | 
			
		||||
    }
 | 
			
		||||
    override fun pageListRequest(chapter: SChapter): Request =
 | 
			
		||||
        GET(baseUrl + chapter.url.substringBefore("#"), headers)
 | 
			
		||||
 | 
			
		||||
    override fun pageListParse(response: Response): List<Page> {
 | 
			
		||||
        return json.decodeFromString<PayloadPagesDto>(response.body.string()).chapter.pages.mapIndexed { i, img ->
 | 
			
		||||
            Page(i, "", img)
 | 
			
		||||
        val document = response.asJsoup()
 | 
			
		||||
        return document.select("section > div.img > img").mapIndexed { i, element ->
 | 
			
		||||
            Page(i, imageUrl = element.attr("abs:src"))
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -109,16 +109,6 @@ class ChapterMetaDto(
 | 
			
		||||
    fun hasNextPage() = currentPage < lastPage
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@Serializable
 | 
			
		||||
class PayloadPagesDto(
 | 
			
		||||
    val chapter: PageDto,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@Serializable
 | 
			
		||||
class PageDto(
 | 
			
		||||
    val pages: List<String>,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@Serializable
 | 
			
		||||
class SeriesStatusDto(
 | 
			
		||||
    val id: Long,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user