Revert "MangaLife - Fetch Host" (#2046)

Revert "MangaLife - Fetch Host"
This commit is contained in:
happywillow0 2020-01-12 10:43:30 -05:00 committed by arkon
parent cf340a1890
commit ff8f8f3d76
2 changed files with 8 additions and 10 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: MangaLife'
pkgNameSuffix = 'en.mangalife'
extClass = '.MangaLife'
extVersionCode = 3
extVersionCode = 4
libVersion = '1.2'
}

View File

@ -11,7 +11,10 @@ import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.*
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import rx.Observable
import java.text.SimpleDateFormat
import java.util.Locale
@ -245,19 +248,14 @@ class MangaLife : HttpSource() {
val curChapter = gson.fromJson<JsonElement>(script.substringAfter("vm.CurChapter = ").substringBefore(";"))
val pageTotal = curChapter["Page"].string.toInt()
var chNum = chapterImage(curChapter["Chapter"].string)
val host = "https://" + script.substringAfter("vm.CurPathName = \"").substringBefore("\"")
val titleURI = script.substringAfter("vm.IndexName = \"").substringBefore("\"")
val seasonURI = curChapter["Directory"].string
.let { if (it.isEmpty()) "" else "$it/" }
val path = "$host/manga/$titleURI/$seasonURI"
val reqJSON = "{\"IndexName\":\"$titleURI\",\"Chapter\":\"$chNum\"}"
val request = Request.Builder()
.url("$baseUrl/read-online/fetch.php")
.post(RequestBody.create(MediaType.parse("application/json; charset=utf-8"),reqJSON))
.build()
val host = client.newCall(request).execute().body()!!.string().substringAfter("PathName\":\"").substringBefore("\"")
val path = "https://$host/manga/$titleURI/$seasonURI"
var chNum = chapterImage(curChapter["Chapter"].string)
return IntRange(1, pageTotal).mapIndexed { i, _ ->
var imageNum = (i + 1).toString().let { "000$it" }.let { it.substring(it.length-3) }