[RU]Grouple disable library redirects (again and limit) (#10941)

* [RU]Grouple disable library redirects (again and limit)

* chapter_number get rid of zero

* minimizing erroneous site numbering chapters (visibility only name)
This commit is contained in:
e-shl 2022-02-27 19:48:14 +05:00 committed by GitHub
parent 91ae13fa20
commit ef2c7c761d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 20 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'AllHentai' extName = 'AllHentai'
pkgNameSuffix = 'ru.allhentai' pkgNameSuffix = 'ru.allhentai'
extClass = '.AllHentai' extClass = '.AllHentai'
extVersionCode = 16 extVersionCode = 17
isNsfw = true isNsfw = true
} }

View File

@ -25,6 +25,7 @@ import org.jsoup.nodes.Element
import rx.Observable import rx.Observable
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.DecimalFormat
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -49,10 +50,10 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() {
override val client: OkHttpClient = network.client.newBuilder() override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor) .addNetworkInterceptor(rateLimitInterceptor)
.addInterceptor { chain -> .addNetworkInterceptor { chain ->
val originalRequest = chain.request() val originalRequest = chain.request()
val response = chain.proceed(originalRequest) val response = chain.proceed(originalRequest)
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)) if (originalRequest.url.toString().contains(baseUrl) and (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)))
throw Exception("Манга переехала на другой адрес/ссылку!") throw Exception("Манга переехала на другой адрес/ссылку!")
response response
} }
@ -235,11 +236,13 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() {
val single = Regex("""\s*Сингл\s*""") val single = Regex("""\s*Сингл\s*""")
when { when {
extra.containsMatchIn(chapter.name) -> { extra.containsMatchIn(chapter.name) -> {
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ") if (chapter.name.substringAfter("Экстра").trim().isEmpty())
chapter.name = chapter.name.replaceFirst(" ", " - " + DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " ")
} }
single.containsMatchIn(chapter.name) -> { single.containsMatchIn(chapter.name) -> {
chapter.name = chapter.chapter_number.toString() + " " + chapter.name if (chapter.name.substringAfter("Сингл").trim().isEmpty())
chapter.name = DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " " + chapter.name
} }
} }
} }

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mintmanga' extName = 'Mintmanga'
pkgNameSuffix = 'ru.mintmanga' pkgNameSuffix = 'ru.mintmanga'
extClass = '.Mintmanga' extClass = '.Mintmanga'
extVersionCode = 39 extVersionCode = 40
} }
dependencies { dependencies {

View File

@ -25,6 +25,7 @@ import org.jsoup.nodes.Element
import rx.Observable import rx.Observable
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.DecimalFormat
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -48,10 +49,10 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
override val client: OkHttpClient = network.client.newBuilder() override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor) .addNetworkInterceptor(rateLimitInterceptor)
.addInterceptor { chain -> .addNetworkInterceptor { chain ->
val originalRequest = chain.request() val originalRequest = chain.request()
val response = chain.proceed(originalRequest) val response = chain.proceed(originalRequest)
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)) if (originalRequest.url.toString().contains(baseUrl) and (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)))
throw Exception("Манга переехала на другой адрес/ссылку!") throw Exception("Манга переехала на другой адрес/ссылку!")
response response
} }
@ -267,11 +268,13 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
val single = Regex("""\s*Сингл\s*""") val single = Regex("""\s*Сингл\s*""")
when { when {
extra.containsMatchIn(chapter.name) -> { extra.containsMatchIn(chapter.name) -> {
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ") if (chapter.name.substringAfter("Экстра").trim().isEmpty())
chapter.name = chapter.name.replaceFirst(" ", " - " + DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " ")
} }
single.containsMatchIn(chapter.name) -> { single.containsMatchIn(chapter.name) -> {
chapter.name = chapter.chapter_number.toString() + " " + chapter.name if (chapter.name.substringAfter("Сингл").trim().isEmpty())
chapter.name = DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " " + chapter.name
} }
} }
} }

View File

@ -5,7 +5,7 @@ ext {
extName = 'Readmanga' extName = 'Readmanga'
pkgNameSuffix = 'ru.readmanga' pkgNameSuffix = 'ru.readmanga'
extClass = '.Readmanga' extClass = '.Readmanga'
extVersionCode = 38 extVersionCode = 39
} }
dependencies { dependencies {

View File

@ -25,6 +25,7 @@ import org.jsoup.nodes.Element
import rx.Observable import rx.Observable
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.DecimalFormat
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -48,10 +49,10 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
override val client: OkHttpClient = network.client.newBuilder() override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor) .addNetworkInterceptor(rateLimitInterceptor)
.addInterceptor { chain -> .addNetworkInterceptor { chain ->
val originalRequest = chain.request() val originalRequest = chain.request()
val response = chain.proceed(originalRequest) val response = chain.proceed(originalRequest)
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)) if (originalRequest.url.toString().contains(baseUrl) and (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)))
throw Exception("Манга переехала на другой адрес/ссылку!") throw Exception("Манга переехала на другой адрес/ссылку!")
response response
} }
@ -268,11 +269,13 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
val single = Regex("""\s*Сингл\s*""") val single = Regex("""\s*Сингл\s*""")
when { when {
extra.containsMatchIn(chapter.name) -> { extra.containsMatchIn(chapter.name) -> {
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ") if (chapter.name.substringAfter("Экстра").trim().isEmpty())
chapter.name = chapter.name.replaceFirst(" ", " - " + DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " ")
} }
single.containsMatchIn(chapter.name) -> { single.containsMatchIn(chapter.name) -> {
chapter.name = chapter.chapter_number.toString() + " " + chapter.name if (chapter.name.substringAfter("Сингл").trim().isEmpty())
chapter.name = DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " " + chapter.name
} }
} }
} }

View File

@ -5,7 +5,7 @@ ext {
extName = 'Selfmanga' extName = 'Selfmanga'
pkgNameSuffix = 'ru.selfmanga' pkgNameSuffix = 'ru.selfmanga'
extClass = '.Selfmanga' extClass = '.Selfmanga'
extVersionCode = 16 extVersionCode = 17
} }
dependencies { dependencies {

View File

@ -15,6 +15,7 @@ import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.text.DecimalFormat
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -34,10 +35,10 @@ class Selfmanga : ParsedHttpSource() {
override val client: OkHttpClient = network.client.newBuilder() override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor) .addNetworkInterceptor(rateLimitInterceptor)
.addInterceptor { chain -> .addNetworkInterceptor { chain ->
val originalRequest = chain.request() val originalRequest = chain.request()
val response = chain.proceed(originalRequest) val response = chain.proceed(originalRequest)
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)) if (originalRequest.url.toString().contains(baseUrl) and (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301)))
throw Exception("Манга переехала на другой адрес/ссылку!") throw Exception("Манга переехала на другой адрес/ссылку!")
response response
} }
@ -151,11 +152,13 @@ class Selfmanga : ParsedHttpSource() {
val single = Regex("""\s*Сингл\s*""") val single = Regex("""\s*Сингл\s*""")
when { when {
extra.containsMatchIn(chapter.name) -> { extra.containsMatchIn(chapter.name) -> {
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ") if (chapter.name.substringAfter("Экстра").trim().isEmpty())
chapter.name = chapter.name.replaceFirst(" ", " - " + DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " ")
} }
single.containsMatchIn(chapter.name) -> { single.containsMatchIn(chapter.name) -> {
chapter.name = chapter.chapter_number.toString() + " " + chapter.name if (chapter.name.substringAfter("Сингл").trim().isEmpty())
chapter.name = DecimalFormat("#,###.##").format(chapter.chapter_number).replace(",", ".") + " " + chapter.name
} }
} }
} }