MangaLib: Fixed pages loading and global search (#1293)

MangaLib: Fixed pages loading and global search
This commit is contained in:
Kirill 2019-07-14 08:24:52 +05:00 committed by Eugene
parent 389986df98
commit b2562177da
3 changed files with 9 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: LibManga' appName = 'Tachiyomi: LibManga'
pkgNameSuffix = 'ru.libmanga' pkgNameSuffix = 'ru.libmanga'
extClass = '.LibMangaFactory' extClass = '.LibMangaFactory'
extVersionCode = 5 extVersionCode = 6
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -11,10 +11,10 @@ import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.* import okhttp3.*
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import rx.Observable
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import android.util.Base64.decode as base64Decode import android.util.Base64.decode as base64Decode
import rx.Observable
open class LibManga(override val name: String, override val baseUrl: String, private val staticUrl: String) : HttpSource() { open class LibManga(override val name: String, override val baseUrl: String, private val staticUrl: String) : HttpSource() {
@ -186,6 +186,11 @@ open class LibManga(override val name: String, override val baseUrl: String, pri
override fun imageUrlParse(response: Response): String = "" override fun imageUrlParse(response: Response): String = ""
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (csrfToken.isEmpty()) {
val tokenResponse = client.newCall(popularMangaRequest(page)).execute()
val resBody = tokenResponse.body()!!.string()
csrfToken = "_token\" content=\"(.*)\"".toRegex().find(resBody)!!.groups[1]!!.value
}
val url = HttpUrl.parse("$baseUrl/filterlist?page=$page")!!.newBuilder() val url = HttpUrl.parse("$baseUrl/filterlist?page=$page")!!.newBuilder()
if (query.isNotEmpty()) { if (query.isNotEmpty()) {
url.addQueryParameter("name", query) url.addQueryParameter("name", query)
@ -263,7 +268,7 @@ open class LibManga(override val name: String, override val baseUrl: String, pri
private class OrderBy : Filter.Sort("Сортировка", private class OrderBy : Filter.Sort("Сортировка",
arrayOf("Рейтинг", "Имя", "Просмотры", "Дата", "Кол-во глав"), arrayOf("Рейтинг", "Имя", "Просмотры", "Дата", "Кол-во глав"),
Filter.Sort.Selection(0, false)) Selection(0, false))
/* /*
* Use console * Use console

View File

@ -13,4 +13,4 @@ fun getAllLibManga(): List<Source> {
) )
} }
class Mangalib : LibManga("Mangalib", "https://mangalib.me", "https://img1.mangalib.me") class Mangalib : LibManga("Mangalib", "https://mangalib.me", "https://img3.mangalib.me")