* [RU]Lib fix mobile parse in #11516 * authorization message * other error * lost
This commit is contained in:
parent
542d588699
commit
b1e252455f
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'HentaiLib'
|
||||
pkgNameSuffix = 'ru.libhentai'
|
||||
extClass = '.LibHentai'
|
||||
extVersionCode = 12
|
||||
extVersionCode = 13
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.preference.PreferenceScreen
|
|||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.POST
|
||||
import eu.kanade.tachiyomi.network.asObservable
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
|
@ -63,7 +64,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
override val baseUrl = "https://hentailib.me"
|
||||
|
||||
override fun headersBuilder() = Headers.Builder().apply {
|
||||
//User-Agent required for authorization through third-party accounts (mobile version for correct display in WebView)
|
||||
// User-Agent required for authorization through third-party accounts (mobile version for correct display in WebView)
|
||||
add("User-Agent", "Mozilla/5.0 (Linux; Android 10; SM-G980F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Mobile Safari/537.36")
|
||||
add("Accept", "image/webp,*/*;q=0.8")
|
||||
add("Referer", baseUrl)
|
||||
|
@ -91,7 +92,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
val originalRequest = chain.request()
|
||||
if (originalRequest.url.toString().contains(baseUrl))
|
||||
if (!authClient.newCall(GET(baseUrl, headers))
|
||||
.execute().body!!.string().contains("header-right-menu__avatar")
|
||||
.execute().body!!.string().contains("m-menu__user-info")
|
||||
)
|
||||
throw Exception("Для просмотра 18+ контента необходима авторизация через WebView")
|
||||
return@addInterceptor chain.proceed(originalRequest)
|
||||
|
@ -150,7 +151,12 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
|
||||
private fun fetchPopularMangaFromApi(page: Int): Observable<MangasPage> {
|
||||
return client.newCall(POST("$baseUrl/filterlist?dir=desc&sort=views&page=$page", catalogHeaders()))
|
||||
.asObservableSuccess()
|
||||
.asObservable().doOnNext { response ->
|
||||
if (!response.isSuccessful) {
|
||||
response.close()
|
||||
if (response.code == 419) throw Exception("Для завершения авторизации необходимо перезапустить приложение с полной остановкой.") else throw Exception("HTTP error ${response.code}")
|
||||
}
|
||||
}
|
||||
.map { response ->
|
||||
popularMangaParse(response)
|
||||
}
|
||||
|
@ -203,8 +209,8 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
rawAgeStop = "0+"
|
||||
}
|
||||
|
||||
val ratingValue = document.select(".media-rating.media-rating_lg div.media-rating__value").text().toFloat() * 2
|
||||
val ratingVotes = document.select(".media-rating.media-rating_lg div.media-rating__votes").text()
|
||||
val ratingValue = document.select(".media-rating__value").last().text().toFloat() * 2
|
||||
val ratingVotes = document.select(".media-rating__votes").last().text()
|
||||
val ratingStar = when {
|
||||
ratingValue > 9.5 -> "★★★★★"
|
||||
ratingValue > 8.5 -> "★★★★✬"
|
||||
|
@ -224,7 +230,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
isEng.equals("eng") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content
|
||||
else -> dataManga!!.jsonObject["name"]!!.jsonPrimitive.content
|
||||
}
|
||||
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
|
||||
manga.thumbnail_url = document.select(".media-header__cover").attr("src")
|
||||
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
|
||||
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
|
||||
manga.status = if (document.html().contains("paper empty section")
|
||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'MangaLib'
|
||||
pkgNameSuffix = 'ru.libmanga'
|
||||
extClass = '.LibManga'
|
||||
extVersionCode = 68
|
||||
extVersionCode = 69
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.preference.PreferenceScreen
|
|||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.POST
|
||||
import eu.kanade.tachiyomi.network.asObservable
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
|
@ -84,7 +85,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
override val baseUrl: String = domain.toString()
|
||||
|
||||
override fun headersBuilder() = Headers.Builder().apply {
|
||||
//User-Agent required for authorization through third-party accounts (mobile version for correct display in WebView)
|
||||
// User-Agent required for authorization through third-party accounts (mobile version for correct display in WebView)
|
||||
add("User-Agent", "Mozilla/5.0 (Linux; Android 10; SM-G980F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Mobile Safari/537.36")
|
||||
add("Accept", "image/webp,*/*;q=0.8")
|
||||
add("Referer", baseUrl)
|
||||
|
@ -143,7 +144,12 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
|
||||
private fun fetchPopularMangaFromApi(page: Int): Observable<MangasPage> {
|
||||
return client.newCall(POST("$baseUrl/filterlist?dir=desc&sort=views&page=$page", catalogHeaders()))
|
||||
.asObservableSuccess()
|
||||
.asObservable().doOnNext { response ->
|
||||
if (!response.isSuccessful) {
|
||||
response.close()
|
||||
if (response.code == 419) throw Exception("Для завершения авторизации необходимо перезапустить приложение с полной остановкой.") else throw Exception("HTTP error ${response.code}")
|
||||
}
|
||||
}
|
||||
.map { response ->
|
||||
popularMangaParse(response)
|
||||
}
|
||||
|
@ -196,8 +202,8 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
rawAgeStop = "0+"
|
||||
}
|
||||
|
||||
val ratingValue = document.select(".media-rating.media-rating_lg div.media-rating__value").text().toFloat() * 2
|
||||
val ratingVotes = document.select(".media-rating.media-rating_lg div.media-rating__votes").text()
|
||||
val ratingValue = document.select(".media-rating__value").last().text().toFloat() * 2
|
||||
val ratingVotes = document.select(".media-rating__votes").last().text()
|
||||
val ratingStar = when {
|
||||
ratingValue > 9.5 -> "★★★★★"
|
||||
ratingValue > 8.5 -> "★★★★✬"
|
||||
|
@ -217,7 +223,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
isEng.equals("eng") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content
|
||||
else -> dataManga!!.jsonObject["name"]!!.jsonPrimitive.content
|
||||
}
|
||||
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
|
||||
manga.thumbnail_url = document.select(".media-header__cover").attr("src")
|
||||
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
|
||||
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
|
||||
manga.status = if (document.html().contains("paper empty section")
|
||||
|
|
Loading…
Reference in New Issue