Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SenshiManga: Update api url #4002

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/es/senshimanga/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'Senshi Manga'
extClass = '.SenshiManga'
extVersionCode = 2
extVersionCode = 3
isNsfw = false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class SenshiManga : HttpSource() {

override val baseUrl = "https://senshimanga.com"

private val apiUrl = "https://api.senshimanga.com"

override val lang = "es"

override val supportsLatest = true
Expand All @@ -32,6 +34,7 @@ class SenshiManga : HttpSource() {

override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 3)
.rateLimitHost(apiUrl.toHttpUrl(), 3)
.build()

override fun headersBuilder(): Headers.Builder = super.headersBuilder()
Expand All @@ -42,17 +45,17 @@ class SenshiManga : HttpSource() {
.build()

override fun popularMangaRequest(page: Int): Request =
GET("$baseUrl/api/manga-custom?page=$page&limit=$PAGE_LIMIT&order=popular", apiHeaders)
GET("$apiUrl/api/manga-custom?page=$page&limit=$PAGE_LIMIT&order=popular", apiHeaders)

override fun popularMangaParse(response: Response): MangasPage = searchMangaParse(response)

override fun latestUpdatesRequest(page: Int): Request =
GET("$baseUrl/api/manga-custom?page=$page&limit=$PAGE_LIMIT&order=latest", apiHeaders)
GET("$apiUrl/api/manga-custom?page=$page&limit=$PAGE_LIMIT&order=latest", apiHeaders)

override fun latestUpdatesParse(response: Response): MangasPage = searchMangaParse(response)

override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/api/manga-custom".toHttpUrl().newBuilder()
val url = "$apiUrl/api/manga-custom".toHttpUrl().newBuilder()

url.setQueryParameter("page", page.toString())
url.setQueryParameter("limit", PAGE_LIMIT.toString())
Expand Down Expand Up @@ -91,7 +94,7 @@ class SenshiManga : HttpSource() {
override fun getMangaUrl(manga: SManga): String = "$baseUrl/manga/${manga.url}"

override fun mangaDetailsRequest(manga: SManga): Request =
GET("$baseUrl/api/manga-custom/${manga.url}", apiHeaders)
GET("$apiUrl/api/manga-custom/${manga.url}", apiHeaders)

override fun mangaDetailsParse(response: Response): SManga {
val result = json.decodeFromString<Data<SeriesDto>>(response.body.string())
Expand All @@ -117,7 +120,7 @@ class SenshiManga : HttpSource() {
val seriesSlug = chapter.url.substringBefore("/")
val chapterSlug = chapter.url.substringAfter("/")

return GET("$baseUrl/api/manga-custom/$seriesSlug/chapter/$chapterSlug/pages", apiHeaders)
return GET("$apiUrl/api/manga-custom/$seriesSlug/chapter/$chapterSlug/pages", apiHeaders)
}

override fun pageListParse(response: Response): List<Page> {
Expand Down