Json build fixes
This commit is contained in:
parent
2104b60b81
commit
70e7974396
@ -724,7 +724,7 @@ class EHentai(
|
||||
})
|
||||
}
|
||||
|
||||
val outJson = JsonParser().parse(client.newCall(Request.Builder()
|
||||
val outJson = JsonParser.parseString(client.newCall(Request.Builder()
|
||||
.url(EH_API_BASE)
|
||||
.post(RequestBody.create(JSON, json.toString()))
|
||||
.build()).execute().body!!.string()).obj
|
||||
|
@ -44,7 +44,6 @@ import uy.kohesive.injekt.injectLazy
|
||||
*/
|
||||
class Hitomi : HttpSource(), LewdSource<HitomiSearchMetadata, Document>, UrlImportableSource {
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val jsonParser by lazy { JsonParser() }
|
||||
|
||||
override val id = HITOMI_SOURCE_ID
|
||||
|
||||
@ -365,7 +364,7 @@ class Hitomi : HttpSource(), LewdSource<HitomiSearchMetadata, Document>, UrlImpo
|
||||
override fun pageListParse(response: Response): List<Page> {
|
||||
val hlId = response.request.url.pathSegments.last().removeSuffix(".js").toLong()
|
||||
val str = response.body!!.string()
|
||||
val json = jsonParser.parse(str.removePrefix("var galleryinfo = "))
|
||||
val json = JsonParser.parseString(str.removePrefix("var galleryinfo = "))
|
||||
return json["files"].array.mapIndexed { index, jsonElement ->
|
||||
val hash = jsonElement["hash"].string
|
||||
val ext = if (jsonElement["haswebp"].string == "0") jsonElement["name"].string.split('.').last() else "webp"
|
||||
|
@ -173,7 +173,7 @@ class NHentai(context: Context) : HttpSource(), LewdSource<NHentaiSearchMetadata
|
||||
|
||||
override fun parseIntoMetadata(metadata: NHentaiSearchMetadata, input: Response) {
|
||||
val json = GALLERY_JSON_REGEX.find(input.body!!.string())!!.groupValues[1]
|
||||
val obj = jsonParser.parse(json).asJsonObject
|
||||
val obj = JsonParser.parseString(json).asJsonObject
|
||||
|
||||
with(metadata) {
|
||||
nhId = obj["id"].asLong
|
||||
@ -313,9 +313,5 @@ class NHentai(context: Context) : HttpSource(), LewdSource<NHentaiSearchMetadata
|
||||
Pair("Japanese", " japanese"),
|
||||
Pair("Chinese", " chinese")
|
||||
)
|
||||
|
||||
val jsonParser by lazy {
|
||||
JsonParser()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ class HBrowse : HttpSource(), LewdSource<HBrowseSearchMetadata, Document>, UrlIm
|
||||
?: continue
|
||||
val pageList = PAGE_LIST_REGEX.find(script)?.groupValues?.getOrNull(1) ?: continue
|
||||
|
||||
return jsonParser.parse(pageList).array.take(totalPages).map {
|
||||
return JsonParser.parseString(pageList).array.take(totalPages).map {
|
||||
it.string
|
||||
}.mapIndexed { index, pageName ->
|
||||
Page(
|
||||
@ -462,8 +462,6 @@ class HBrowse : HttpSource(), LewdSource<HBrowseSearchMetadata, Document>, UrlIm
|
||||
private val PAGE_LIST_REGEX = Regex("list *= *(\\[.*]);")
|
||||
private val TOTAL_PAGES_REGEX = Regex("totalPages *= *([0-9]*);")
|
||||
|
||||
private val jsonParser by lazy { JsonParser() }
|
||||
|
||||
private const val BASE_COOKIES = "thumbnails=1;"
|
||||
|
||||
private val NS_MAPPINGS = mapOf(
|
||||
|
@ -1,7 +1,6 @@
|
||||
package eu.kanade.tachiyomi.source.online.english
|
||||
|
||||
import android.net.Uri
|
||||
import com.google.gson.JsonParser
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
@ -120,7 +119,6 @@ class Tsumino(delegate: HttpSource) : DelegatedHttpSource(delegate),
|
||||
)
|
||||
|
||||
companion object {
|
||||
val jsonParser by lazy { JsonParser() }
|
||||
val TM_DATE_FORMAT = SimpleDateFormat("yyyy MMM dd", Locale.US)
|
||||
private val ASP_NET_COOKIE_NAME = "ASP.NET_SessionId"
|
||||
}
|
||||
|
@ -406,7 +406,6 @@ open class BrowseSourcePresenter(
|
||||
}
|
||||
|
||||
// EXH -->
|
||||
private val jsonParser = JsonParser()
|
||||
private val filterSerializer = FilterSerializer()
|
||||
fun saveSearches(searches: List<EXHSavedSearch>) {
|
||||
val otherSerialized = prefs.eh_savedSearches().getOrDefault().filter {
|
||||
@ -428,7 +427,7 @@ open class BrowseSourcePresenter(
|
||||
try {
|
||||
val id = it.substringBefore(':').toLong()
|
||||
if (id != source.id) return@map null
|
||||
val content = jsonParser.parse(it.substringAfter(':')).obj
|
||||
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
||||
val originalFilters = source.getFilterList()
|
||||
filterSerializer.deserialize(originalFilters, content["filters"].array)
|
||||
EXHSavedSearch(content["name"].string,
|
||||
|
@ -49,7 +49,6 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
private val networkHelper: NetworkHelper by injectLazy()
|
||||
|
||||
val httpClient = networkHelper.client
|
||||
private val jsonParser = JsonParser()
|
||||
|
||||
private var currentLoopId: String? = null
|
||||
private var validateCurrentLoopId: String? = null
|
||||
@ -155,7 +154,7 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
.asObservableSuccess()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.map {
|
||||
val json = jsonParser.parse(it.body!!.string())
|
||||
val json = JsonParser.parseString(it.body!!.string())
|
||||
it.close()
|
||||
json["token"].string
|
||||
}.melt()
|
||||
@ -292,7 +291,7 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
.build())
|
||||
.build()).asObservableSuccess()
|
||||
}.map { response ->
|
||||
jsonParser.parse(response.body!!.string())["results"][0]["alternatives"][0]["transcript"].string.trim()
|
||||
JsonParser.parseString(response.body!!.string())["results"][0]["alternatives"][0]["transcript"].string.trim()
|
||||
}.toSingle()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user