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