Replace usages of Gson (#10079)
This commit is contained in:
parent
2cf0e7779f
commit
1f6027dd67
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Mango'
|
extName = 'Mango'
|
||||||
|
|
|
@ -4,11 +4,6 @@ import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.get
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import com.google.gson.JsonSyntaxException
|
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
|
@ -22,6 +17,13 @@ import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import info.debatty.java.stringsimilarity.JaroWinkler
|
import info.debatty.java.stringsimilarity.JaroWinkler
|
||||||
import info.debatty.java.stringsimilarity.Levenshtein
|
import info.debatty.java.stringsimilarity.Levenshtein
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
|
import kotlinx.serialization.json.long
|
||||||
import okhttp3.Dns
|
import okhttp3.Dns
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
|
@ -33,6 +35,7 @@ import okhttp3.Response
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class Mango : ConfigurableSource, HttpSource() {
|
class Mango : ConfigurableSource, HttpSource() {
|
||||||
|
@ -43,18 +46,18 @@ class Mango : ConfigurableSource, HttpSource() {
|
||||||
// Our popular manga are just our library of manga
|
// Our popular manga are just our library of manga
|
||||||
override fun popularMangaParse(response: Response): MangasPage {
|
override fun popularMangaParse(response: Response): MangasPage {
|
||||||
val result = try {
|
val result = try {
|
||||||
gson.fromJson<JsonObject>(response.body!!.string())
|
json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
} catch (e: JsonSyntaxException) {
|
} catch (e: Exception) {
|
||||||
apiCookies = ""
|
apiCookies = ""
|
||||||
throw Exception("Login Likely Failed. Try Refreshing.")
|
throw Exception("Login Likely Failed. Try Refreshing.")
|
||||||
}
|
}
|
||||||
val mangas = result["titles"].asJsonArray
|
val mangas = result["titles"]!!.jsonArray
|
||||||
return MangasPage(
|
return MangasPage(
|
||||||
mangas.asJsonArray.map {
|
mangas.jsonArray.map {
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
url = "/book/" + it["id"].asString
|
url = "/book/" + it.jsonObject["id"]!!.jsonPrimitive.content
|
||||||
title = it["display_name"].asString
|
title = it.jsonObject["display_name"]!!.jsonPrimitive.content
|
||||||
thumbnail_url = baseUrl + it["cover_url"].asString
|
thumbnail_url = baseUrl + it.jsonObject["cover_url"]!!.jsonPrimitive.content
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
@ -119,15 +122,15 @@ class Mango : ConfigurableSource, HttpSource() {
|
||||||
// This will just return the same thing as the main library endpoint
|
// This will just return the same thing as the main library endpoint
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
val result = try {
|
val result = try {
|
||||||
gson.fromJson<JsonObject>(response.body!!.string())
|
json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
} catch (e: JsonSyntaxException) {
|
} catch (e: Exception) {
|
||||||
apiCookies = ""
|
apiCookies = ""
|
||||||
throw Exception("Login Likely Failed. Try Refreshing.")
|
throw Exception("Login Likely Failed. Try Refreshing.")
|
||||||
}
|
}
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
url = "/book/" + result["id"].asString
|
url = "/book/" + result.jsonObject["id"]!!.jsonPrimitive.content
|
||||||
title = result["display_name"].asString
|
title = result.jsonObject["display_name"]!!.jsonPrimitive.content
|
||||||
thumbnail_url = baseUrl + result["cover_url"].asString
|
thumbnail_url = baseUrl + result.jsonObject["cover_url"]!!.jsonPrimitive.content
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +140,8 @@ class Mango : ConfigurableSource, HttpSource() {
|
||||||
// The chapter url will contain how many pages the chapter contains for our page list endpoint
|
// The chapter url will contain how many pages the chapter contains for our page list endpoint
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val result = try {
|
val result = try {
|
||||||
gson.fromJson<JsonObject>(response.body!!.string())
|
json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
} catch (e: JsonSyntaxException) {
|
} catch (e: Exception) {
|
||||||
apiCookies = ""
|
apiCookies = ""
|
||||||
throw Exception("Login Likely Failed. Try Refreshing.")
|
throw Exception("Login Likely Failed. Try Refreshing.")
|
||||||
}
|
}
|
||||||
|
@ -148,17 +151,17 @@ class Mango : ConfigurableSource, HttpSource() {
|
||||||
// Helper function for listing chapters and chapters in nested titles recursively
|
// Helper function for listing chapters and chapters in nested titles recursively
|
||||||
private fun listChapters(titleObj: JsonObject): List<SChapter> {
|
private fun listChapters(titleObj: JsonObject): List<SChapter> {
|
||||||
val chapters = mutableListOf<SChapter>()
|
val chapters = mutableListOf<SChapter>()
|
||||||
val topChapters = titleObj.getAsJsonArray("entries")?.map { obj ->
|
val topChapters = titleObj["entries"]?.jsonArray?.map { obj ->
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
name = obj["display_name"].asString
|
name = obj.jsonObject["display_name"]!!.jsonPrimitive.content
|
||||||
url =
|
url =
|
||||||
"/page/${obj["title_id"].asString}/${obj["id"].asString}/${obj["pages"].asString}/"
|
"/page/${obj.jsonObject["title_id"]!!.jsonPrimitive.content}/${obj.jsonObject["id"]!!.jsonPrimitive.content}/${obj.jsonObject["pages"]!!.jsonPrimitive.content}/"
|
||||||
date_upload = 1000L * obj["mtime"].asLong
|
date_upload = 1000L * obj.jsonObject["mtime"]!!.jsonPrimitive.long
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val subChapters = titleObj.getAsJsonArray("titles")?.map { obj ->
|
val subChapters = titleObj["titles"]?.jsonArray?.map { obj ->
|
||||||
val name = obj["display_name"].asString
|
val name = obj.jsonObject["display_name"]!!.jsonPrimitive.content
|
||||||
listChapters(obj.asJsonObject).map { chp ->
|
listChapters(obj.jsonObject).map { chp ->
|
||||||
chp.name = "$name / ${chp.name}"
|
chp.name = "$name / ${chp.name}"
|
||||||
chp
|
chp
|
||||||
}
|
}
|
||||||
|
@ -200,11 +203,11 @@ class Mango : ConfigurableSource, HttpSource() {
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
override val supportsLatest = false
|
override val supportsLatest = false
|
||||||
|
|
||||||
|
private val json: Json by injectLazy()
|
||||||
override val baseUrl by lazy { getPrefBaseUrl() }
|
override val baseUrl by lazy { getPrefBaseUrl() }
|
||||||
private val port by lazy { getPrefPort() }
|
private val port by lazy { getPrefPort() }
|
||||||
private val username by lazy { getPrefUsername() }
|
private val username by lazy { getPrefUsername() }
|
||||||
private val password by lazy { getPrefPassword() }
|
private val password by lazy { getPrefPassword() }
|
||||||
private val gson by lazy { Gson() }
|
|
||||||
private var apiCookies: String = ""
|
private var apiCookies: String = ""
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder =
|
override fun headersBuilder(): Headers.Builder =
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Fansubs.cat'
|
extName = 'Fansubs.cat'
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.ca.fansubscat
|
package eu.kanade.tachiyomi.extension.ca.fansubscat
|
||||||
|
|
||||||
import com.github.salomonbrys.kotson.float
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.get
|
|
||||||
import com.github.salomonbrys.kotson.long
|
|
||||||
import com.github.salomonbrys.kotson.nullString
|
|
||||||
import com.github.salomonbrys.kotson.string
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
|
@ -17,12 +9,22 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.contentOrNull
|
||||||
|
import kotlinx.serialization.json.float
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
|
import kotlinx.serialization.json.long
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class FansubsCat : HttpSource() {
|
class FansubsCat : HttpSource() {
|
||||||
|
|
||||||
|
@ -39,22 +41,22 @@ class FansubsCat : HttpSource() {
|
||||||
|
|
||||||
override val client: OkHttpClient = network.client
|
override val client: OkHttpClient = network.client
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
private val apiBaseUrl = "https://api.fansubs.cat"
|
private val apiBaseUrl = "https://api.fansubs.cat"
|
||||||
|
|
||||||
private fun parseMangaFromJson(response: Response): MangasPage {
|
private fun parseMangaFromJson(response: Response): MangasPage {
|
||||||
val jsonObject = gson.fromJson<JsonObject>(response.body!!.string())
|
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
|
|
||||||
val mangas = jsonObject["result"].asJsonArray.map { json ->
|
val mangas = jsonObject["result"]!!.jsonArray.map { json ->
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
url = json["slug"].string
|
url = json.jsonObject["slug"]!!.jsonPrimitive.content
|
||||||
title = json["name"].string
|
title = json.jsonObject["name"]!!.jsonPrimitive.content
|
||||||
thumbnail_url = json["thumbnail_url"].string
|
thumbnail_url = json.jsonObject["thumbnail_url"]!!.jsonPrimitive.content
|
||||||
author = json["author"].nullString
|
author = json.jsonObject["author"]!!.jsonPrimitive.contentOrNull
|
||||||
description = json["synopsis"].nullString
|
description = json.jsonObject["synopsis"]!!.jsonPrimitive.contentOrNull
|
||||||
status = json["status"].string.toStatus()
|
status = json.jsonObject["status"]!!.jsonPrimitive.content.toStatus()
|
||||||
genre = json["genres"].nullString
|
genre = json.jsonObject["genres"]!!.jsonPrimitive.contentOrNull
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,24 +64,24 @@ class FansubsCat : HttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterListFromJson(response: Response): List<SChapter> {
|
private fun parseChapterListFromJson(response: Response): List<SChapter> {
|
||||||
val jsonObject = gson.fromJson<JsonObject>(response.body!!.string())
|
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
|
|
||||||
return jsonObject["result"].asJsonArray.map { json ->
|
return jsonObject["result"]!!.jsonArray.map { json ->
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
url = json["id"].string
|
url = json.jsonObject["id"]!!.jsonPrimitive.content
|
||||||
name = json["title"].string
|
name = json.jsonObject["title"]!!.jsonPrimitive.content
|
||||||
chapter_number = json["number"].float
|
chapter_number = json.jsonObject["number"]!!.jsonPrimitive.float
|
||||||
scanlator = json["fansub"].string
|
scanlator = json.jsonObject["fansub"]!!.jsonPrimitive.content
|
||||||
date_upload = json["created"].long
|
date_upload = json.jsonObject["created"]!!.jsonPrimitive.long
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parsePageListFromJson(response: Response): List<Page> {
|
private fun parsePageListFromJson(response: Response): List<Page> {
|
||||||
val jsonObject = gson.fromJson<JsonObject>(response.body!!.string())
|
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
|
|
||||||
return jsonObject["result"].asJsonArray.mapIndexed { i, it ->
|
return jsonObject["result"]!!.jsonArray.mapIndexed { i, it ->
|
||||||
Page(i, it["url"].asString, it["url"].asString)
|
Page(i, it.jsonObject["url"]!!.jsonPrimitive.content, it.jsonObject["url"]!!.jsonPrimitive.content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,16 +126,17 @@ class FansubsCat : HttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
val jsonObject = gson.fromJson<JsonObject>(response.body!!.string())
|
val jsonObject = json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
|
val resultObject = jsonObject.jsonObject["result"]!!.jsonObject
|
||||||
|
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
url = jsonObject["result"]["slug"].string
|
url = resultObject["slug"]!!.jsonPrimitive.content
|
||||||
title = jsonObject["result"]["name"].string
|
title = resultObject["name"]!!.jsonPrimitive.content
|
||||||
thumbnail_url = jsonObject["result"]["thumbnail_url"].string
|
thumbnail_url = resultObject["thumbnail_url"]!!.jsonPrimitive.content
|
||||||
author = jsonObject["result"]["author"].nullString
|
author = resultObject["author"]!!.jsonPrimitive.contentOrNull
|
||||||
description = jsonObject["result"]["synopsis"].nullString
|
description = resultObject["synopsis"]!!.jsonPrimitive.contentOrNull
|
||||||
status = jsonObject["result"]["status"].string.toStatus()
|
status = resultObject["status"]!!.jsonPrimitive.content.toStatus()
|
||||||
genre = jsonObject["result"]["genres"].nullString
|
genre = resultObject["genres"]!!.jsonPrimitive.contentOrNull
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Doujins'
|
extName = 'Doujins'
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.doujins
|
package eu.kanade.tachiyomi.extension.en.doujins
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.get
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
@ -15,11 +9,16 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.injectLazy
|
||||||
import uy.kohesive.injekt.api.get
|
|
||||||
import java.text.ParseException
|
import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
@ -37,16 +36,12 @@ class Doujins : HttpSource() {
|
||||||
|
|
||||||
override val supportsLatest: Boolean = true
|
override val supportsLatest: Boolean = true
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
return listOf(
|
return listOf(
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
var element = response.asJsoup()
|
val element = response.asJsoup()
|
||||||
name = "Chapter"
|
name = "Chapter"
|
||||||
scanlator = element.select("div.folder-message:contains(Translated)").text().substringAfter("by:").trim()
|
scanlator = element.select("div.folder-message:contains(Translated)").text().substringAfter("by:").trim()
|
||||||
setUrlWithoutDomain(response.request.url.toString())
|
setUrlWithoutDomain(response.request.url.toString())
|
||||||
|
@ -68,14 +63,14 @@ class Doujins : HttpSource() {
|
||||||
|
|
||||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||||
return MangasPage(
|
return MangasPage(
|
||||||
gson.fromJson<JsonObject>(response.body!!.string())["folders"].asJsonArray.map {
|
json.decodeFromString<JsonObject>(response.body!!.string())["folders"]!!.jsonArray.map {
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
setUrlWithoutDomain(it["link"].asString)
|
setUrlWithoutDomain(it.jsonObject["link"]!!.jsonPrimitive.content)
|
||||||
title = it["name"].asString
|
title = it.jsonObject["name"]!!.jsonPrimitive.content
|
||||||
artist = it["artistList"].asString
|
artist = it.jsonObject["artistList"]!!.jsonPrimitive.content
|
||||||
author = artist
|
author = artist
|
||||||
genre = it["tags"].asJsonArray.joinToString(", ") { it["tag"].asString }
|
genre = it.jsonObject["tags"]!!.jsonArray.joinToString(", ") { it.jsonObject["tag"]!!.jsonPrimitive.content }
|
||||||
thumbnail_url = it["thumbnail2"].asString
|
thumbnail_url = it.jsonObject["thumbnail2"]!!.jsonPrimitive.content
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Madokami'
|
extName = 'Madokami'
|
||||||
|
|
|
@ -3,9 +3,6 @@ package eu.kanade.tachiyomi.extension.en.madokami
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonArray
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
@ -13,6 +10,10 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.Credentials
|
import okhttp3.Credentials
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
|
@ -23,6 +24,7 @@ import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
@ -36,7 +38,7 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
override val supportsLatest = false
|
override val supportsLatest = false
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH)
|
private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH)
|
||||||
|
|
||||||
|
@ -154,7 +156,7 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val element = document.select("div#reader")
|
val element = document.select("div#reader")
|
||||||
val path = element.attr("data-path")
|
val path = element.attr("data-path")
|
||||||
val files = gson.fromJson<JsonArray>(element.attr("data-files"))
|
val files = json.decodeFromString<JsonArray>(element.attr("data-files"))
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
for ((index, file) in files.withIndex()) {
|
for ((index, file) in files.withIndex()) {
|
||||||
val url = HttpUrl.Builder()
|
val url = HttpUrl.Builder()
|
||||||
|
@ -162,7 +164,7 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
|
||||||
.host("manga.madokami.al")
|
.host("manga.madokami.al")
|
||||||
.addPathSegments("reader/image")
|
.addPathSegments("reader/image")
|
||||||
.addEncodedQueryParameter("path", URLEncoder.encode(path, "UTF-8"))
|
.addEncodedQueryParameter("path", URLEncoder.encode(path, "UTF-8"))
|
||||||
.addEncodedQueryParameter("file", URLEncoder.encode(file.asString, "UTF-8"))
|
.addEncodedQueryParameter("file", URLEncoder.encode(file.jsonPrimitive.content, "UTF-8"))
|
||||||
.build()
|
.build()
|
||||||
.toUrl()
|
.toUrl()
|
||||||
pages.add(Page(index, url.toExternalForm(), url.toExternalForm()))
|
pages.add(Page(index, url.toExternalForm(), url.toExternalForm()))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Manga Linkz'
|
extName = 'Manga Linkz'
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.mangalinkz
|
package eu.kanade.tachiyomi.extension.en.mangalinkz
|
||||||
|
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.string
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -137,14 +139,14 @@ class MangaLinkz : ParsedHttpSource() {
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
|
|
||||||
private val gson by lazy { Gson() }
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val encoded = document.select("script:containsData(atob)").first().data()
|
val encoded = document.select("script:containsData(atob)").first().data()
|
||||||
.substringAfter("atob(\"").substringBefore("\"")
|
.substringAfter("atob(\"").substringBefore("\"")
|
||||||
val decoded = Base64.decode(encoded, Base64.DEFAULT).toString(Charsets.UTF_8).removeSurrounding("[", "]")
|
val decoded = Base64.decode(encoded, Base64.DEFAULT).toString(Charsets.UTF_8).removeSurrounding("[", "]")
|
||||||
|
|
||||||
return gson.fromJson<JsonObject>(decoded)["pages"].asJsonArray.mapIndexed { i, jsonElement -> Page(i, "", jsonElement.string) }
|
return json.decodeFromString<JsonObject>(decoded)["pages"]!!.jsonArray.mapIndexed { i, jsonElement -> Page(i, "", jsonElement.jsonPrimitive.content) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Multporn'
|
extName = 'Multporn'
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.multporn
|
package eu.kanade.tachiyomi.extension.en.multporn
|
||||||
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.get
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonArray
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.network.asObservable
|
import eu.kanade.tachiyomi.network.asObservable
|
||||||
|
@ -16,6 +12,11 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
|
@ -27,6 +28,7 @@ import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.schedulers.Schedulers
|
import rx.schedulers.Schedulers
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class Multporn : ParsedHttpSource() {
|
class Multporn : ParsedHttpSource() {
|
||||||
|
@ -36,7 +38,7 @@ class Multporn : ParsedHttpSource() {
|
||||||
override val baseUrl = "https://multporn.net"
|
override val baseUrl = "https://multporn.net"
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||||
.add("User-Agent", HEADER_USER_AGENT)
|
.add("User-Agent", HEADER_USER_AGENT)
|
||||||
|
@ -65,8 +67,8 @@ class Multporn : ParsedHttpSource() {
|
||||||
override fun popularMangaRequest(page: Int) = buildPopularMangaRequest(page - 1)
|
override fun popularMangaRequest(page: Int) = buildPopularMangaRequest(page - 1)
|
||||||
|
|
||||||
override fun popularMangaParse(response: Response): MangasPage {
|
override fun popularMangaParse(response: Response): MangasPage {
|
||||||
val html = gson.fromJson<JsonArray>(response.body!!.string())
|
val html = json.decodeFromString<JsonArray>(response.body!!.string())
|
||||||
.last { it["command"].asString == "insert" }.asJsonObject["data"].asString
|
.last { it.jsonObject["command"]!!.jsonPrimitive.content == "insert" }.jsonObject["data"]!!.jsonPrimitive.content
|
||||||
|
|
||||||
return super.popularMangaParse(
|
return super.popularMangaParse(
|
||||||
response.newBuilder()
|
response.newBuilder()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Henchan'
|
extName = 'Henchan'
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
package eu.kanade.tachiyomi.extension.ru.henchan
|
package eu.kanade.tachiyomi.extension.ru.henchan
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import com.github.salomonbrys.kotson.array
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.string
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonArray
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.asObservable
|
import eu.kanade.tachiyomi.network.asObservable
|
||||||
|
@ -17,6 +11,12 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -24,6 +24,7 @@ import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
@ -254,17 +255,17 @@ class Henchan : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = throw Exception("Not Used")
|
override fun imageUrlParse(document: Document) = throw Exception("Not Used")
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
private fun Document.parseJsonArray(): JsonArray {
|
private fun Document.parseJsonArray(): JsonArray {
|
||||||
val imgScript = this.select("script:containsData(fullimg)").first().toString()
|
val imgScript = this.select("script:containsData(fullimg)").first().toString()
|
||||||
val imgString = imgScript.substring(imgScript.indexOf('{'), imgScript.lastIndexOf('}') + 1).replace(""", "\"")
|
val imgString = imgScript.substring(imgScript.indexOf('{'), imgScript.lastIndexOf('}') + 1).replace(""", "\"")
|
||||||
return gson.fromJson<JsonObject>(imgString)["fullimg"].array
|
return json.decodeFromString<JsonObject>(imgString)["fullimg"]!!.jsonArray
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.parseJsonArray().mapIndexed { index, imageUrl ->
|
return document.parseJsonArray().mapIndexed { index, imageUrl ->
|
||||||
Page(index, imageUrl = imageUrl.string.replace(".gif.webp", ".gif"))
|
Page(index, imageUrl = imageUrl.jsonPrimitive.content.replace(".gif.webp", ".gif"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Nekopost'
|
extName = 'Nekopost'
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost
|
package eu.kanade.tachiyomi.extension.th.nekopost
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawChapterInfo
|
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawChapterInfo
|
||||||
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawProjectInfo
|
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawProjectInfo
|
||||||
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawProjectNameList
|
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawProjectNameListItem
|
||||||
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawProjectSummaryList
|
import eu.kanade.tachiyomi.extension.th.nekopost.model.RawProjectSummaryList
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
|
@ -13,6 +12,8 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -20,11 +21,12 @@ import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class Nekopost : ParsedHttpSource() {
|
class Nekopost : ParsedHttpSource() {
|
||||||
private val gson: Gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
override val baseUrl: String = "https://www.nekopost.net/project"
|
override val baseUrl: String = "https://www.nekopost.net/project"
|
||||||
|
|
||||||
private val latestMangaEndpoint: String =
|
private val latestMangaEndpoint: String =
|
||||||
|
@ -81,10 +83,10 @@ class Nekopost : ParsedHttpSource() {
|
||||||
.map { response ->
|
.map { response ->
|
||||||
val responseBody =
|
val responseBody =
|
||||||
response.body ?: throw Error("Unable to fetch manga detail of ${manga.title}")
|
response.body ?: throw Error("Unable to fetch manga detail of ${manga.title}")
|
||||||
val projectInfo = gson.fromJson(responseBody.string(), RawProjectInfo::class.java)
|
val projectInfo: RawProjectInfo = json.decodeFromString(responseBody.string())
|
||||||
|
|
||||||
manga.apply {
|
manga.apply {
|
||||||
projectInfo.projectData.let {
|
projectInfo.projectInfo.let {
|
||||||
url = it.npProjectId
|
url = it.npProjectId
|
||||||
title = it.npName
|
title = it.npName
|
||||||
artist = it.artistName
|
artist = it.artistName
|
||||||
|
@ -95,7 +97,7 @@ class Nekopost : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
genre =
|
genre =
|
||||||
projectInfo.projectCategoryUsed.map { it.npcName }.joinToString(", ")
|
projectInfo.projectCategoryUsed.joinToString(", ") { it.npcName }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,8 +110,7 @@ class Nekopost : ParsedHttpSource() {
|
||||||
val responseBody =
|
val responseBody =
|
||||||
response.body
|
response.body
|
||||||
?: throw Error("Unable to fetch manga detail of ${manga.title}")
|
?: throw Error("Unable to fetch manga detail of ${manga.title}")
|
||||||
val projectInfo =
|
val projectInfo: RawProjectInfo = json.decodeFromString(responseBody.string())
|
||||||
gson.fromJson(responseBody.string(), RawProjectInfo::class.java)
|
|
||||||
|
|
||||||
projectInfo.projectChapterList.map { chapter ->
|
projectInfo.projectChapterList.map { chapter ->
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
|
@ -137,8 +138,7 @@ class Nekopost : ParsedHttpSource() {
|
||||||
val responseBody =
|
val responseBody =
|
||||||
response.body
|
response.body
|
||||||
?: throw Error("Unable to fetch page list of chapter ${chapter.chapter_number}")
|
?: throw Error("Unable to fetch page list of chapter ${chapter.chapter_number}")
|
||||||
val chapterInfo =
|
val chapterInfo: RawChapterInfo = json.decodeFromString(responseBody.string())
|
||||||
gson.fromJson(responseBody.string(), RawChapterInfo::class.java)
|
|
||||||
|
|
||||||
chapterInfo.pageItem.map { page ->
|
chapterInfo.pageItem.map { page ->
|
||||||
Page(
|
Page(
|
||||||
|
@ -159,7 +159,7 @@ class Nekopost : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun popularMangaParse(response: Response): MangasPage {
|
override fun popularMangaParse(response: Response): MangasPage {
|
||||||
val responseBody = response.body ?: throw Error("Unable to fetch mangas")
|
val responseBody = response.body ?: throw Error("Unable to fetch mangas")
|
||||||
val projectList = gson.fromJson(responseBody.string(), RawProjectSummaryList::class.java)
|
val projectList: RawProjectSummaryList = json.decodeFromString(responseBody.string())
|
||||||
|
|
||||||
val mangaList: List<SManga> =
|
val mangaList: List<SManga> =
|
||||||
projectList.listItem
|
projectList.listItem
|
||||||
|
@ -200,8 +200,7 @@ class Nekopost : ParsedHttpSource() {
|
||||||
.asObservableSuccess()
|
.asObservableSuccess()
|
||||||
.map { response ->
|
.map { response ->
|
||||||
val responseBody = response.body ?: throw Error("Unable to fetch title list")
|
val responseBody = response.body ?: throw Error("Unable to fetch title list")
|
||||||
val projectList =
|
val projectList: List<RawProjectNameListItem> = json.decodeFromString(responseBody.string())
|
||||||
gson.fromJson(responseBody.string(), RawProjectNameList::class.java)
|
|
||||||
|
|
||||||
val mangaList: List<SManga> = projectList.filter { project ->
|
val mangaList: List<SManga> = projectList.filter { project ->
|
||||||
Regex(
|
Regex(
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawChapterInfo(
|
data class RawChapterInfo(
|
||||||
@SerializedName("chapterId")
|
|
||||||
val chapterId: Int,
|
val chapterId: Int,
|
||||||
@SerializedName("chapterNo")
|
|
||||||
val chapterNo: String,
|
val chapterNo: String,
|
||||||
@SerializedName("pageCount")
|
|
||||||
val pageCount: Int,
|
val pageCount: Int,
|
||||||
@SerializedName("pageItem")
|
|
||||||
val pageItem: List<RawPageItem>,
|
val pageItem: List<RawPageItem>,
|
||||||
@SerializedName("projectId")
|
|
||||||
val projectId: String
|
val projectId: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawPageItem(
|
data class RawPageItem(
|
||||||
@SerializedName("fileName")
|
|
||||||
val fileName: String,
|
val fileName: String,
|
||||||
@SerializedName("height")
|
|
||||||
val height: Int,
|
val height: Int,
|
||||||
@SerializedName("pageNo")
|
|
||||||
val pageNo: Int,
|
val pageNo: Int,
|
||||||
@SerializedName("width")
|
|
||||||
val width: Int
|
val width: Int
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectCategory(
|
data class RawProjectCategory(
|
||||||
@SerializedName("npc_name")
|
@SerialName("npc_name")
|
||||||
val npcName: String,
|
val npcName: String,
|
||||||
@SerializedName("npc_name_link")
|
@SerialName("npc_name_link")
|
||||||
val npcNameLink: String
|
val npcNameLink: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectChapter(
|
data class RawProjectChapter(
|
||||||
@SerializedName("cu_displayname")
|
@SerializedName("cu_displayname")
|
||||||
val cuDisplayname: String,
|
val cuDisplayname: String,
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectInfo(
|
data class RawProjectInfo(
|
||||||
@SerializedName("code")
|
|
||||||
val code: String,
|
val code: String,
|
||||||
@SerializedName("projectCategoryUsed")
|
|
||||||
val projectCategoryUsed: List<RawProjectCategory>,
|
val projectCategoryUsed: List<RawProjectCategory>,
|
||||||
@SerializedName("projectChapterList")
|
|
||||||
val projectChapterList: List<RawProjectChapter>,
|
val projectChapterList: List<RawProjectChapter>,
|
||||||
@SerializedName("projectInfo")
|
val projectInfo: RawProjectInfoData
|
||||||
val projectData: RawProjectInfoData
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectInfoData(
|
data class RawProjectInfoData(
|
||||||
@SerializedName("artist_name")
|
@SerializedName("artist_name")
|
||||||
val artistName: String,
|
val artistName: String,
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
|
||||||
|
|
||||||
class RawProjectNameList : ArrayList<RawProjectNameListItem>()
|
|
|
@ -1,18 +1,20 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectNameListItem(
|
data class RawProjectNameListItem(
|
||||||
@SerializedName("np_name")
|
@SerialName("np_name")
|
||||||
val npName: String,
|
val npName: String,
|
||||||
@SerializedName("np_name_link")
|
@SerialName("np_name_link")
|
||||||
val npNameLink: String,
|
val npNameLink: String,
|
||||||
@SerializedName("np_no_chapter")
|
@SerialName("np_no_chapter")
|
||||||
val npNoChapter: String,
|
val npNoChapter: String,
|
||||||
@SerializedName("np_project_id")
|
@SerialName("np_project_id")
|
||||||
val npProjectId: String,
|
val npProjectId: String,
|
||||||
@SerializedName("np_status")
|
@SerialName("np_status")
|
||||||
val npStatus: String,
|
val npStatus: String,
|
||||||
@SerializedName("np_type")
|
@SerialName("np_type")
|
||||||
val npType: String
|
val npType: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,28 +1,30 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectSummary(
|
data class RawProjectSummary(
|
||||||
@SerializedName("nc_chapter_cover")
|
@SerialName("nc_chapter_cover")
|
||||||
val ncChapterCover: String,
|
val ncChapterCover: String,
|
||||||
@SerializedName("nc_chapter_id")
|
@SerialName("nc_chapter_id")
|
||||||
val ncChapterId: String,
|
val ncChapterId: String,
|
||||||
@SerializedName("nc_chapter_name")
|
@SerialName("nc_chapter_name")
|
||||||
val ncChapterName: String,
|
val ncChapterName: String,
|
||||||
@SerializedName("nc_chapter_no")
|
@SerialName("nc_chapter_no")
|
||||||
val ncChapterNo: String,
|
val ncChapterNo: String,
|
||||||
@SerializedName("nc_created_date")
|
@SerialName("nc_created_date")
|
||||||
val ncCreatedDate: String,
|
val ncCreatedDate: String,
|
||||||
@SerializedName("nc_provider")
|
@SerialName("nc_provider")
|
||||||
val ncProvider: String,
|
val ncProvider: String,
|
||||||
@SerializedName("no_new_chapter")
|
@SerialName("no_new_chapter")
|
||||||
val noNewChapter: String,
|
val noNewChapter: String,
|
||||||
@SerializedName("np_group_dir")
|
@SerialName("np_group_dir")
|
||||||
val npGroupDir: String,
|
val npGroupDir: String,
|
||||||
@SerializedName("np_name")
|
@SerialName("np_name")
|
||||||
val npName: String,
|
val npName: String,
|
||||||
@SerializedName("np_name_link")
|
@SerialName("np_name_link")
|
||||||
val npNameLink: String,
|
val npNameLink: String,
|
||||||
@SerializedName("np_project_id")
|
@SerialName("np_project_id")
|
||||||
val npProjectId: String
|
val npProjectId: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
package eu.kanade.tachiyomi.extension.th.nekopost.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class RawProjectSummaryList(
|
data class RawProjectSummaryList(
|
||||||
@SerializedName("code")
|
|
||||||
val code: String,
|
val code: String,
|
||||||
@SerializedName("listItem")
|
|
||||||
val listItem: List<RawProjectSummary>?
|
val listItem: List<RawProjectSummary>?
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Comico'
|
extName = 'Comico'
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.comico
|
package eu.kanade.tachiyomi.extension.zh.comico
|
||||||
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.get
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonElement
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
@ -12,12 +7,19 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -33,7 +35,7 @@ abstract class Comico(
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
override val client: OkHttpClient = network.cloudflareClient
|
||||||
|
|
||||||
val gson = Gson()
|
val json: Json by injectLazy()
|
||||||
|
|
||||||
// Popular
|
// Popular
|
||||||
|
|
||||||
|
@ -122,12 +124,12 @@ abstract class Comico(
|
||||||
return POST("$baseUrl/api/getArticleList.nhn", chapterListHeaders, body)
|
return POST("$baseUrl/api/getArticleList.nhn", chapterListHeaders, body)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun chapterFromJson(jsonElement: JsonElement): SChapter {
|
fun chapterFromJson(jsonObject: JsonObject): SChapter {
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
|
|
||||||
chapter.name = jsonElement["subtitle"].asString
|
chapter.name = jsonObject["subtitle"]!!.jsonPrimitive.content
|
||||||
chapter.setUrlWithoutDomain(jsonElement["articleDetailUrl"].asString)
|
chapter.setUrlWithoutDomain(jsonObject["articleDetailUrl"]!!.jsonPrimitive.content)
|
||||||
chapter.date_upload = parseDate(jsonElement["date"].asString)
|
chapter.date_upload = parseDate(jsonObject["date"]!!.jsonPrimitive.content)
|
||||||
|
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
@ -135,9 +137,14 @@ abstract class Comico(
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val chapters = mutableListOf<SChapter>()
|
val chapters = mutableListOf<SChapter>()
|
||||||
|
|
||||||
gson.fromJson<JsonObject>(response.body!!.string())["result"]["list"].asJsonArray.forEach {
|
json.decodeFromString<JsonObject>(response.body!!.string())["result"]!!
|
||||||
if (it["freeFlg"].asString == "Y") chapters.add(chapterFromJson(it))
|
.jsonObject["list"]!!
|
||||||
}
|
.jsonArray
|
||||||
|
.forEach {
|
||||||
|
if (it.jsonObject["freeFlg"]!!.jsonPrimitive.content == "Y") {
|
||||||
|
chapters.add(chapterFromJson(it.jsonObject))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return chapters.reversed()
|
return chapters.reversed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.comico
|
package eu.kanade.tachiyomi.extension.zh.comico
|
||||||
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.github.salomonbrys.kotson.get
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.SourceFactory
|
import eu.kanade.tachiyomi.source.SourceFactory
|
||||||
|
@ -10,6 +7,11 @@ import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
@ -36,21 +38,24 @@ class ComicoChallenge : Comico("Comico Challenge", "/challenge", true) {
|
||||||
val mangas = mutableListOf<SManga>()
|
val mangas = mutableListOf<SManga>()
|
||||||
val body = response.body!!.string()
|
val body = response.body!!.string()
|
||||||
|
|
||||||
gson.fromJson<JsonObject>(body)["result"]["list"].asJsonArray.forEach {
|
json.decodeFromString<JsonObject>(body)["result"]!!
|
||||||
val manga = SManga.create()
|
.jsonObject["list"]!!
|
||||||
|
.jsonArray
|
||||||
|
.forEach {
|
||||||
|
val manga = SManga.create()
|
||||||
|
|
||||||
manga.thumbnail_url = it["img_url"].asString
|
manga.thumbnail_url = it.jsonObject["img_url"]!!.jsonPrimitive.content
|
||||||
manga.title = it["article_title"].asString
|
manga.title = it.jsonObject["article_title"]!!.jsonPrimitive.content
|
||||||
manga.author = it["author"].asString
|
manga.author = it.jsonObject["author"]!!.jsonPrimitive.content
|
||||||
manga.description = it["description"].asString
|
manga.description = it.jsonObject["description"]!!.jsonPrimitive.content
|
||||||
manga.url = it["article_url"].asString.substringAfter(urlModifier)
|
manga.url = it.jsonObject["article_url"]!!.jsonPrimitive.content.substringAfter(urlModifier)
|
||||||
manga.status = if (it["is_end"].asString == "false") SManga.ONGOING else SManga.COMPLETED
|
manga.status = if (it.jsonObject["is_end"]!!.jsonPrimitive.content == "false") SManga.ONGOING else SManga.COMPLETED
|
||||||
|
|
||||||
mangas.add(manga)
|
mangas.add(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
val lastPage = gson.fromJson<JsonObject>(body)["result"]["totalPageCnt"].asString
|
val lastPage = json.decodeFromString<JsonObject>(body)["result"]!!.jsonObject["totalPageCnt"]!!.jsonPrimitive.content
|
||||||
val currentPage = gson.fromJson<JsonObject>(body)["result"]["currentPageNo"].asString
|
val currentPage = json.decodeFromString<JsonObject>(body)["result"]!!.jsonObject["currentPageNo"]!!.jsonPrimitive.content
|
||||||
|
|
||||||
return MangasPage(mangas, currentPage < lastPage)
|
return MangasPage(mangas, currentPage < lastPage)
|
||||||
}
|
}
|
||||||
|
@ -82,8 +87,12 @@ class ComicoChallenge : Comico("Comico Challenge", "/challenge", true) {
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val chapters = mutableListOf<SChapter>()
|
val chapters = mutableListOf<SChapter>()
|
||||||
|
|
||||||
gson.fromJson<JsonObject>(response.body!!.string())["result"]["list"].asJsonArray
|
json.decodeFromString<JsonObject>(response.body!!.string())["result"]!!
|
||||||
.forEach { chapters.add(chapterFromJson(it)) }
|
.jsonObject["list"]!!
|
||||||
|
.jsonArray
|
||||||
|
.forEach {
|
||||||
|
chapters.add(chapterFromJson(it.jsonObject))
|
||||||
|
}
|
||||||
|
|
||||||
return chapters.reversed()
|
return chapters.reversed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'ManHuaGui'
|
extName = 'ManHuaGui'
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.manhuagui
|
package eu.kanade.tachiyomi.extension.zh.manhuagui
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Comic(
|
data class Comic(
|
||||||
val bid: Int? = 0,
|
val bid: Int? = 0,
|
||||||
val block_cc: String? = "",
|
val block_cc: String? = "",
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.extension.zh.manhuagui
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.squareup.duktape.Duktape
|
import com.squareup.duktape.Duktape
|
||||||
import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor
|
import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
@ -22,6 +21,8 @@ import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.Call
|
import okhttp3.Call
|
||||||
import okhttp3.Callback
|
import okhttp3.Callback
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
|
@ -37,6 +38,7 @@ import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -65,7 +67,7 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() {
|
||||||
|
|
||||||
private val imageServer = arrayOf("https://i.hamreus.com", "https://cf.hamreus.com")
|
private val imageServer = arrayOf("https://i.hamreus.com", "https://cf.hamreus.com")
|
||||||
private val mobileWebsiteUrl = "https://m.$baseHost"
|
private val mobileWebsiteUrl = "https://m.$baseHost"
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
private val baseHttpUrl: HttpUrl = baseUrl.toHttpUrlOrNull()!!
|
private val baseHttpUrl: HttpUrl = baseUrl.toHttpUrlOrNull()!!
|
||||||
|
|
||||||
// Add rate limit to fix manga thumbnail load failure
|
// Add rate limit to fix manga thumbnail load failure
|
||||||
|
@ -388,7 +390,7 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val imgJsonStr = re2.find(imgDecode)?.groups?.get(0)?.value
|
val imgJsonStr = re2.find(imgDecode)?.groups?.get(0)?.value
|
||||||
val imageJson: Comic = gson.fromJson(imgJsonStr, Comic::class.java)
|
val imageJson: Comic = json.decodeFromString(imgJsonStr!!)
|
||||||
|
|
||||||
return imageJson.files!!.mapIndexed { i, imgStr ->
|
return imageJson.files!!.mapIndexed { i, imgStr ->
|
||||||
val imgurl = "${imageServer[0]}${imageJson.path}$imgStr?cid=${imageJson.cid}&md5=${imageJson.sl?.md5}"
|
val imgurl = "${imageServer[0]}${imageJson.path}$imgStr?cid=${imageJson.cid}&md5=${imageJson.sl?.md5}"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.manhuagui
|
package eu.kanade.tachiyomi.extension.zh.manhuagui
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Sl(
|
data class Sl(
|
||||||
val md5: String? = ""
|
val md5: String? = ""
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'Tohomh123'
|
extName = 'Tohomh123'
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.tohomh123
|
package eu.kanade.tachiyomi.extension.zh.tohomh123
|
||||||
|
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
@ -10,11 +7,16 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -142,10 +144,10 @@ class Tohomh : ParsedHttpSource() {
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
override fun imageUrlParse(response: Response): String {
|
override fun imageUrlParse(response: Response): String {
|
||||||
return gson.fromJson<JsonObject>(response.body!!.string())["Code"].asString
|
return json.decodeFromString<JsonObject>(response.body!!.string())["Code"]!!.jsonPrimitive.content
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlinx-serialization'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'WuqiManga'
|
extName = 'WuqiManga'
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.wuqimanga
|
package eu.kanade.tachiyomi.extension.zh.wuqimanga
|
||||||
|
|
||||||
class Comic {
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Comic {
|
||||||
val fs: List<String?>? = listOf()
|
val fs: List<String?>? = listOf()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.wuqimanga
|
package eu.kanade.tachiyomi.extension.zh.wuqimanga
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.squareup.duktape.Duktape
|
import com.squareup.duktape.Duktape
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
@ -9,11 +8,14 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class WuqiManga : ParsedHttpSource() {
|
class WuqiManga : ParsedHttpSource() {
|
||||||
|
|
||||||
|
@ -137,7 +139,7 @@ class WuqiManga : ParsedHttpSource() {
|
||||||
return chapters
|
return chapters
|
||||||
}
|
}
|
||||||
|
|
||||||
private val gson = Gson()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val html = document.html()
|
val html = document.html()
|
||||||
|
@ -147,7 +149,7 @@ class WuqiManga : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
val re2 = Regex("""\{.*\}""")
|
val re2 = Regex("""\{.*\}""")
|
||||||
val imgJsonStr = re2.find(result)?.groups?.get(0)?.value
|
val imgJsonStr = re2.find(result)?.groups?.get(0)?.value
|
||||||
val imageJson: Comic = gson.fromJson(imgJsonStr, Comic::class.java)
|
val imageJson: Comic = json.decodeFromString(imgJsonStr!!)
|
||||||
|
|
||||||
return imageJson.fs!!.mapIndexed { i, imgStr ->
|
return imageJson.fs!!.mapIndexed { i, imgStr ->
|
||||||
val imgurl = "$imageServer$imgStr"
|
val imgurl = "$imageServer$imgStr"
|
||||||
|
|
Loading…
Reference in New Issue