Remove GMANGA (gmanga.org) (#2111)
This commit is contained in:
parent
2d316661f4
commit
da0b929bf3
|
@ -1,8 +0,0 @@
|
|||
ext {
|
||||
extName = 'GMANGA'
|
||||
extClass = '.Gmanga'
|
||||
themePkg = 'gmanga'
|
||||
overrideVersionCode = 13
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
|
@ -1,33 +0,0 @@
|
|||
package eu.kanade.tachiyomi.extension.ar.gmanga
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
|
||||
@Serializable
|
||||
class ChapterListResponse(
|
||||
val releases: List<ChapterRelease>,
|
||||
val chapterizations: List<Chapterization>,
|
||||
val teams: List<Team>,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
class ChapterRelease(
|
||||
val id: Int,
|
||||
@SerialName("chapterization_id") val chapId: Int,
|
||||
@SerialName("team_id") val teamId: Int,
|
||||
val chapter: JsonPrimitive,
|
||||
@SerialName("time_stamp") val timestamp: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
class Chapterization(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
class Team(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
)
|
|
@ -1,90 +0,0 @@
|
|||
package eu.kanade.tachiyomi.extension.ar.gmanga
|
||||
|
||||
import android.app.Application
|
||||
import eu.kanade.tachiyomi.multisrc.gmanga.BrowseManga
|
||||
import eu.kanade.tachiyomi.multisrc.gmanga.Gmanga
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.asObservable
|
||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.decodeFromJsonElement
|
||||
import kotlinx.serialization.json.float
|
||||
import kotlinx.serialization.json.jsonArray
|
||||
import kotlinx.serialization.json.jsonObject
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import rx.Observable
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class Gmanga : Gmanga(
|
||||
"GMANGA",
|
||||
"https://gmanga.org",
|
||||
"ar",
|
||||
"https://media.gmanga.me",
|
||||
) {
|
||||
override val client = super.client.newBuilder()
|
||||
.rateLimit(4)
|
||||
.build()
|
||||
|
||||
init {
|
||||
// remove obsolete preferences
|
||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000).run {
|
||||
if (contains("gmanga_chapter_listing")) {
|
||||
edit().remove("gmanga_chapter_listing").apply()
|
||||
}
|
||||
if (contains("gmanga_last_listing")) {
|
||||
edit().remove("gmanga_last_listing").apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||
val decMga = response.decryptAs<JsonObject>()
|
||||
val selectedManga = decMga["rows"]!!.jsonArray[0].jsonObject["rows"]!!.jsonArray
|
||||
val manags = selectedManga.map {
|
||||
json.decodeFromJsonElement<BrowseManga>(it.jsonArray[17])
|
||||
}
|
||||
|
||||
val entries = manags.map { it.toSManga(::createThumbnail) }
|
||||
.distinctBy { it.url }
|
||||
|
||||
return MangasPage(
|
||||
entries,
|
||||
hasNextPage = (manags.size >= 30),
|
||||
)
|
||||
}
|
||||
|
||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||
return client.newCall(chapterListRequest(manga))
|
||||
.asObservable() // sites returns false 302 code
|
||||
.map(::chapterListParse)
|
||||
}
|
||||
|
||||
override fun chaptersRequest(manga: SManga): Request {
|
||||
val mangaId = manga.url.substringAfterLast("/")
|
||||
return GET("https://api2.gmanga.me/api/mangas/$mangaId/releases", headers)
|
||||
}
|
||||
|
||||
override fun chaptersParse(response: Response): List<SChapter> {
|
||||
val chapterList = response.parseAs<ChapterListResponse>()
|
||||
|
||||
return chapterList.releases.map {
|
||||
SChapter.create().apply {
|
||||
val chapter = chapterList.chapterizations.first { chap -> chap.id == it.chapId }
|
||||
val team = chapterList.teams.firstOrNull { team -> team.id == it.teamId }
|
||||
|
||||
url = "/r/${it.id}"
|
||||
chapter_number = it.chapter.float
|
||||
date_upload = it.timestamp * 1000
|
||||
scanlator = team?.name
|
||||
|
||||
val chapterName = chapter.title.let { if (it.trim() != "") " - $it" else "" }
|
||||
name = "${chapter_number.let { if (it % 1 > 0) it else it.toInt() }}$chapterName"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue