diff --git a/src/th/nekopost/build.gradle b/src/th/nekopost/build.gradle index b3614e24f..780020747 100644 --- a/src/th/nekopost/build.gradle +++ b/src/th/nekopost/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Nekopost' extClass = '.Nekopost' - extVersionCode = 11 + extVersionCode = 12 isNsfw = true } diff --git a/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt b/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt index 31c3b2841..14c5d5c9f 100644 --- a/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt +++ b/src/th/nekopost/src/eu/kanade/tachiyomi/extension/th/nekopost/Nekopost.kt @@ -28,17 +28,16 @@ import java.util.Locale class Nekopost : HttpSource() { private val json: Json by injectLazy() - override val baseUrl: String = "https://www.nekopost.net/project" + override val baseUrl: String = "https://www.nekopost.net" private val latestMangaEndpoint: String = "https://api.osemocphoto.com/frontAPI/getLatestChapter/m" private val projectDataEndpoint: String = "https://api.osemocphoto.com/frontAPI/getProjectInfo" private val fileHost: String = "https://www.osemocphoto.com" - private val nekopostUrl = "https://www.nekopost.net" override val client: OkHttpClient = network.cloudflareClient override fun headersBuilder(): Headers.Builder { - return super.headersBuilder().add("Referer", baseUrl) + return super.headersBuilder().add("Referer", "$baseUrl/") } private val existingProject: HashSet = HashSet() @@ -69,6 +68,8 @@ class Nekopost : HttpSource() { return GET("$projectDataEndpoint/${manga.url}", headers) } + override fun getMangaUrl(manga: SManga) = "$baseUrl/manga/${manga.url}" + override fun mangaDetailsParse(response: Response): SManga { val responseBody = response.body val projectInfo: RawProjectInfo = json.decodeFromString(responseBody.string()) @@ -95,7 +96,7 @@ class Nekopost : HttpSource() { } override fun chapterListRequest(manga: SManga): Request { - val headers = Headers.headersOf("accept", "*/*", "content-type", "text/plain;charset=UTF-8", "origin", nekopostUrl) + val headers = Headers.headersOf("accept", "*/*", "content-type", "text/plain;charset=UTF-8", "origin", baseUrl) return GET("$projectDataEndpoint/${manga.url}", headers) } @@ -127,6 +128,9 @@ class Nekopost : HttpSource() { return GET("$fileHost/collectManga/${chapter.url}", headers) } + override fun getChapterUrl(chapter: SChapter) = + "$baseUrl/manga/${chapter.url.substringBefore("/")}/${chapter.chapter_number.toString().removeSuffix(".0")}" + override fun pageListParse(response: Response): List { val responseBody = response.body val chapterInfo: RawChapterInfo = json.decodeFromString(responseBody.string()) @@ -174,9 +178,9 @@ class Nekopost : HttpSource() { } override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val headers = Headers.headersOf("accept", "*/*", "content-type", "text/plain;charset=UTF-8", "origin", nekopostUrl) + val headers = Headers.headersOf("accept", "*/*", "content-type", "text/plain;charset=UTF-8", "origin", baseUrl) val requestBody = Json.encodeToString(SearchRequest(query, page)).toRequestBody() - return POST("$nekopostUrl/api/explore/search", headers, requestBody) + return POST("$baseUrl/api/explore/search", headers, requestBody) } override fun searchMangaParse(response: Response): MangasPage {