[RU]LibGroup new auth-layout for 18+ (#12534)

* [RU]LibGroup new auth-layout for 18+

* sign-in button
This commit is contained in:
Ejan 2022-07-12 03:42:11 +05:00 committed by GitHub
parent 4d910c38e6
commit aae8b2095d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ class LibGenerator: ThemeSourceGenerator {
override val themeClass = "LibGroup" override val themeClass = "LibGroup"
override val baseVersionCode: Int = 8 override val baseVersionCode: Int = 9
override val sources = listOf( override val sources = listOf(
SingleLang("MangaLib", "https://mangalib.me", "ru", overrideVersionCode = 74), SingleLang("MangaLib", "https://mangalib.me", "ru", overrideVersionCode = 74),

View File

@ -280,7 +280,7 @@ abstract class LibGroup(
return client.newCall(mangaDetailsRequest(manga)) return client.newCall(mangaDetailsRequest(manga))
.asObservable().doOnNext { response -> .asObservable().doOnNext { response ->
if (!response.isSuccessful) { if (!response.isSuccessful) {
if (response.code == 404 && response.asJsoup().select("#show-login-button").isNotEmpty()) throw Exception("HTTP error ${response.code}. Для просмотра 18+ контента необходима авторизация через WebView") else throw Exception("HTTP error ${response.code}") if (response.code == 404 && response.asJsoup().select(".m-menu__sign-in").isNotEmpty()) throw Exception("HTTP error ${response.code}. Для просмотра 18+ контента необходима авторизация через WebView") else throw Exception("HTTP error ${response.code}")
} }
} }
.map { response -> .map { response ->
@ -291,7 +291,7 @@ abstract class LibGroup(
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup() val document = response.asJsoup()
val rawAgeStop = document.select(".media-short-info .media-short-info__item[data-caution]").text() val rawAgeStop = document.select(".media-short-info .media-short-info__item[data-caution]").text()
if (rawAgeStop == "18+" && document.select("#show-login-button").isNotEmpty()) if (rawAgeStop == "18+" && document.select(".m-menu__sign-in").isNotEmpty())
throw Exception("Для просмотра 18+ контента необходима авторизация через WebView") throw Exception("Для просмотра 18+ контента необходима авторизация через WebView")
val redirect = document.html() val redirect = document.html()
if (redirect.contains("paper empty section")) { if (redirect.contains("paper empty section")) {
@ -325,7 +325,7 @@ abstract class LibGroup(
return client.newCall(mangaDetailsRequest(manga)) return client.newCall(mangaDetailsRequest(manga))
.asObservable().doOnNext { response -> .asObservable().doOnNext { response ->
if (!response.isSuccessful) { if (!response.isSuccessful) {
if (response.code == 404 && response.asJsoup().select("#show-login-button").isNotEmpty()) throw Exception("HTTP error ${response.code}. Для просмотра 18+ контента необходима авторизация через WebView") else throw Exception("HTTP error ${response.code}") if (response.code == 404 && response.asJsoup().select(".m-menu__sign-in").isNotEmpty()) throw Exception("HTTP error ${response.code}. Для просмотра 18+ контента необходима авторизация через WebView") else throw Exception("HTTP error ${response.code}")
} }
} }
.map { response -> .map { response ->
@ -420,7 +420,7 @@ abstract class LibGroup(
//redirect Регистрация 18+ //redirect Регистрация 18+
val redirect = document.html() val redirect = document.html()
if (!redirect.contains("window.__info")) { if (!redirect.contains("window.__info")) {
if (redirect.contains("hold-transition login-page")) { if (redirect.contains("auth-layout")) {
throw Exception("Для просмотра 18+ контента необходима авторизация через WebView") throw Exception("Для просмотра 18+ контента необходима авторизация через WebView")
} }
} }