Komiku: use new API endpoint (#2913)

This commit is contained in:
Vetle Ledaal 2024-05-10 15:03:09 +00:00 committed by Draff
parent 43c934d1f8
commit ffa8ba4a45
2 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Komiku' extName = 'Komiku'
extClass = '.Komiku' extClass = '.Komiku'
extVersionCode = 17 extVersionCode = 18
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -21,7 +21,7 @@ class Komiku : ParsedHttpSource() {
override val baseUrl = "https://komiku.id" override val baseUrl = "https://komiku.id"
private val baseUrlData = "https://data.komiku.id" private val baseUrlApi = "https://api.komiku.id"
override val lang = "id" override val lang = "id"
@ -34,9 +34,9 @@ class Komiku : ParsedHttpSource() {
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request {
return if (page == 1) { return if (page == 1) {
GET("$baseUrl/other/hot/?orderby=meta_value_num", headers) GET("$baseUrlApi/other/hot/?orderby=meta_value_num", headers)
} else { } else {
GET("$baseUrl/other/hot/page/$page/?orderby=meta_value_num", headers) GET("$baseUrlApi/other/hot/page/$page/?orderby=meta_value_num", headers)
} }
} }
@ -51,25 +51,25 @@ class Komiku : ParsedHttpSource() {
// scraped image doesn't make for a good cover; so try to transform it // scraped image doesn't make for a good cover; so try to transform it
// make it take bad cover instead of null if it contains upload date as those URLs aren't very useful // make it take bad cover instead of null if it contains upload date as those URLs aren't very useful
if (element.select("img").attr("data-src").contains(coverUploadRegex)) { if (element.select("img").attr("abs:src").contains(coverUploadRegex)) {
manga.thumbnail_url = element.select("img").attr("data-src") manga.thumbnail_url = element.select("img").attr("abs:src")
} else { } else {
manga.thumbnail_url = element.select("img").attr("data-src").substringBeforeLast("?").replace(coverRegex, "/Komik-") manga.thumbnail_url = element.select("img").attr("abs:src").substringBeforeLast("?").replace(coverRegex, "/Komik-")
} }
return manga return manga
} }
override fun popularMangaNextPageSelector() = ".pag-nav a.next" override fun popularMangaNextPageSelector() = "#hxloading + [hx-trigger=revealed]"
// latest // latest
override fun latestUpdatesSelector() = popularMangaSelector() override fun latestUpdatesSelector() = popularMangaSelector()
override fun latestUpdatesRequest(page: Int): Request { override fun latestUpdatesRequest(page: Int): Request {
return if (page == 1) { return if (page == 1) {
GET("$baseUrlData/cari/?post_type=manga&s=&orderby=modified", headers) GET("$baseUrlApi/other/hot/?orderby=modified&category_name=", headers)
} else { } else {
GET("$baseUrlData/cari/page/$page/?post_type=manga&s=&orderby=modified", headers) GET("$baseUrlApi/other/hot/page/$page/?orderby=modified&category_name=", headers)
} }
} }
@ -81,7 +81,7 @@ class Komiku : ParsedHttpSource() {
override fun searchMangaSelector() = popularMangaSelector() override fun searchMangaSelector() = popularMangaSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
var url = "$baseUrlData/page/$page/?post_type=manga".toHttpUrl().newBuilder().addQueryParameter("s", query) var url = "$baseUrlApi/page/$page/?post_type=manga".toHttpUrl().newBuilder().addQueryParameter("s", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> (if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) { when (filter) {
is CategoryNames -> { is CategoryNames -> {