[RU]Grouple correct Chapter Number (simplificade-fix) (#10929)
* [RU]Grouple correct Chapter Number (simplificade-fix) * fix relative rating * mtr back * delete the code under test * disable following redirects
This commit is contained in:
parent
7512d4f8ac
commit
4337cece52
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'AllHentai'
|
||||
pkgNameSuffix = 'ru.allhentai'
|
||||
extClass = '.AllHentai'
|
||||
extVersionCode = 15
|
||||
extVersionCode = 16
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,15 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() {
|
|||
private val rateLimitInterceptor = RateLimitInterceptor(2)
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor).build()
|
||||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.addInterceptor { chain ->
|
||||
val originalRequest = chain.request()
|
||||
val response = chain.proceed(originalRequest)
|
||||
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301))
|
||||
throw Exception("Манга переехала на другой адрес/ссылку!")
|
||||
response
|
||||
}
|
||||
.build()
|
||||
|
||||
override fun popularMangaSelector() = "div.tile"
|
||||
|
||||
|
@ -178,10 +186,11 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() {
|
|||
|
||||
private fun chapterFromElement(element: Element, manga: SManga): SChapter {
|
||||
val urlElement = element.select("a").first()
|
||||
val chapterInf = element.select(".item-data").first()
|
||||
val urlText = urlElement.text()
|
||||
|
||||
val chapter = SChapter.create()
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href"))
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href") + "?mtr=true") // mtr is 18+ skip
|
||||
|
||||
var translators = ""
|
||||
val translatorElement = urlElement.attr("title")
|
||||
|
@ -205,6 +214,8 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() {
|
|||
chapter.name = chapter.name.substringAfter("…").trim()
|
||||
}
|
||||
|
||||
chapter.chapter_number = chapterInf.attr("num").toFloat() / 10
|
||||
|
||||
chapter.date_upload = element.select("td.d-none").last()?.text()?.let {
|
||||
try {
|
||||
SimpleDateFormat("dd.MM.yy", Locale.US).parse(it)?.time ?: 0L
|
||||
|
@ -220,21 +231,14 @@ class AllHentai : ConfigurableSource, ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
||||
val urlChapterNumber = Regex("${manga.url}/vol([0-9])/")
|
||||
val basic = Regex("""\s*([0-9]+)(\s-\s)([0-9]+)\s*""")
|
||||
val extra = Regex("""\s*([0-9]+\sЭкстра)\s*""")
|
||||
val single = Regex("""\s*Сингл\s*""")
|
||||
when {
|
||||
basic.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
}
|
||||
extra.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ")
|
||||
}
|
||||
|
||||
single.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.chapter_number.toString() + " " + chapter.name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Mintmanga'
|
||||
pkgNameSuffix = 'ru.mintmanga'
|
||||
extClass = '.Mintmanga'
|
||||
extVersionCode = 38
|
||||
extVersionCode = 39
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -47,7 +47,15 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
private val rateLimitInterceptor = RateLimitInterceptor(2)
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor).build()
|
||||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.addInterceptor { chain ->
|
||||
val originalRequest = chain.request()
|
||||
val response = chain.proceed(originalRequest)
|
||||
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301))
|
||||
throw Exception("Манга переехала на другой адрес/ссылку!")
|
||||
response
|
||||
}
|
||||
.build()
|
||||
|
||||
private var uagent: String = preferences.getString(UAGENT_TITLE, UAGENT_DEFAULT)!!
|
||||
override fun headersBuilder() = Headers.Builder().apply {
|
||||
|
@ -142,7 +150,7 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
"манга"
|
||||
}
|
||||
val ratingValue = infoElement.select(".col-sm-7 .rating-block").attr("data-score").toFloat() * 2
|
||||
val ratingValueOver = infoElement.select(".info-icon").attr("data-content").substringAfter("Относительно остальных произведений: <b>").substringBefore("/5</b>").replace(",", ".").toFloat() * 2
|
||||
val ratingValueOver = infoElement.select(".info-icon").attr("data-content").substringBeforeLast("/5</b><br/>").substringAfterLast(": <b>").replace(",", ".").toFloat() * 2
|
||||
val ratingVotes = infoElement.select(".col-sm-7 .user-rating meta[itemprop=\"ratingCount\"]").attr("content")
|
||||
val ratingStar = when {
|
||||
ratingValue > 9.5 -> "★★★★★"
|
||||
|
@ -210,10 +218,11 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
|
||||
private fun chapterFromElement(element: Element, manga: SManga): SChapter {
|
||||
val urlElement = element.select("a").first()
|
||||
val chapterInf = element.select(".item-data").first()
|
||||
val urlText = urlElement.text()
|
||||
|
||||
val chapter = SChapter.create()
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href"))
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href") + "?mtr=true") // mtr is 18+ skip
|
||||
|
||||
var translators = ""
|
||||
val translatorElement = urlElement.attr("title")
|
||||
|
@ -237,6 +246,8 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
chapter.name = chapter.name.substringAfter("…").trim()
|
||||
}
|
||||
|
||||
chapter.chapter_number = chapterInf.attr("num").toFloat() / 10
|
||||
|
||||
chapter.date_upload = element.select("td.d-none").last()?.text()?.let {
|
||||
try {
|
||||
SimpleDateFormat("dd.MM.yy", Locale.US).parse(it)?.time ?: 0L
|
||||
|
@ -252,21 +263,14 @@ class Mintmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
||||
val urlChapterNumber = Regex("${manga.url}/vol([0-9])/")
|
||||
val basic = Regex("""\s*([0-9]+)(\s-\s)([0-9]+)\s*""")
|
||||
val extra = Regex("""\s*([0-9]+\sЭкстра)\s*""")
|
||||
val single = Regex("""\s*Сингл\s*""")
|
||||
when {
|
||||
basic.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
}
|
||||
extra.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ")
|
||||
}
|
||||
|
||||
single.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.chapter_number.toString() + " " + chapter.name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Readmanga'
|
||||
pkgNameSuffix = 'ru.readmanga'
|
||||
extClass = '.Readmanga'
|
||||
extVersionCode = 37
|
||||
extVersionCode = 38
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -47,7 +47,15 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
private val rateLimitInterceptor = RateLimitInterceptor(2)
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor).build()
|
||||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.addInterceptor { chain ->
|
||||
val originalRequest = chain.request()
|
||||
val response = chain.proceed(originalRequest)
|
||||
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301))
|
||||
throw Exception("Манга переехала на другой адрес/ссылку!")
|
||||
response
|
||||
}
|
||||
.build()
|
||||
|
||||
private var uagent: String = preferences.getString(UAGENT_TITLE, UAGENT_DEFAULT)!!
|
||||
override fun headersBuilder() = Headers.Builder().apply {
|
||||
|
@ -143,7 +151,7 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
}
|
||||
|
||||
val ratingValue = infoElement.select(".col-sm-7 .rating-block").attr("data-score").toFloat() * 2
|
||||
val ratingValueOver = infoElement.select(".info-icon").attr("data-content").substringAfter("Относительно остальных произведений: <b>").substringBefore("/5</b>").replace(",", ".").toFloat() * 2
|
||||
val ratingValueOver = infoElement.select(".info-icon").attr("data-content").substringBeforeLast("/5</b><br/>").substringAfterLast(": <b>").replace(",", ".").toFloat() * 2
|
||||
val ratingVotes = infoElement.select(".col-sm-7 .user-rating meta[itemprop=\"ratingCount\"]").attr("content")
|
||||
val ratingStar = when {
|
||||
ratingValue > 9.5 -> "★★★★★"
|
||||
|
@ -211,10 +219,11 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
|
||||
private fun chapterFromElement(element: Element, manga: SManga): SChapter {
|
||||
val urlElement = element.select("a").first()
|
||||
val chapterInf = element.select(".item-data").first()
|
||||
val urlText = urlElement.text()
|
||||
|
||||
val chapter = SChapter.create()
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href"))
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href") + "?mtr=true") // mtr is 18+ skip
|
||||
|
||||
var translators = ""
|
||||
val translatorElement = urlElement.attr("title")
|
||||
|
@ -238,6 +247,8 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
chapter.name = chapter.name.substringAfter("…").trim()
|
||||
}
|
||||
|
||||
chapter.chapter_number = chapterInf.attr("num").toFloat() / 10
|
||||
|
||||
chapter.date_upload = element.select("td.d-none").last()?.text()?.let {
|
||||
try {
|
||||
SimpleDateFormat("dd.MM.yy", Locale.US).parse(it)?.time ?: 0L
|
||||
|
@ -253,21 +264,14 @@ class Readmanga : ConfigurableSource, ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
||||
val urlChapterNumber = Regex("${manga.url}/vol([0-9])/")
|
||||
val basic = Regex("""\s*([0-9]+)(\s-\s)([0-9]+)\s*""")
|
||||
val extra = Regex("""\s*([0-9]+\sЭкстра)\s*""")
|
||||
val single = Regex("""\s*Сингл\s*""")
|
||||
when {
|
||||
basic.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
}
|
||||
extra.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ")
|
||||
}
|
||||
|
||||
single.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.chapter_number.toString() + " " + chapter.name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Selfmanga'
|
||||
pkgNameSuffix = 'ru.selfmanga'
|
||||
extClass = '.Selfmanga'
|
||||
extVersionCode = 15
|
||||
extVersionCode = 16
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -33,7 +33,15 @@ class Selfmanga : ParsedHttpSource() {
|
|||
private val rateLimitInterceptor = RateLimitInterceptor(2)
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor).build()
|
||||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.addInterceptor { chain ->
|
||||
val originalRequest = chain.request()
|
||||
val response = chain.proceed(originalRequest)
|
||||
if (originalRequest.url.toString().contains("internal/redirect") or (response.code == 301))
|
||||
throw Exception("Манга переехала на другой адрес/ссылку!")
|
||||
response
|
||||
}
|
||||
.build()
|
||||
|
||||
override fun popularMangaSelector() = "div.tile"
|
||||
|
||||
|
@ -115,15 +123,19 @@ class Selfmanga : ParsedHttpSource() {
|
|||
|
||||
override fun chapterFromElement(element: Element): SChapter {
|
||||
val urlElement = element.select("a").first()
|
||||
val chapterInf = element.select(".item-data").first()
|
||||
val urlText = urlElement.text()
|
||||
|
||||
val chapter = SChapter.create()
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href"))
|
||||
chapter.setUrlWithoutDomain(urlElement.attr("href") + "?mtr=true") // mtr is 18+ skip
|
||||
if (urlText.endsWith(" новое")) {
|
||||
chapter.name = urlText.dropLast(6)
|
||||
} else {
|
||||
chapter.name = urlText
|
||||
}
|
||||
|
||||
chapter.chapter_number = chapterInf.attr("num").toFloat() / 10
|
||||
|
||||
chapter.date_upload = element.select("td.hidden-xxs").last()?.text()?.let {
|
||||
try {
|
||||
SimpleDateFormat("dd/MM/yy", Locale.US).parse(it)?.time ?: 0L
|
||||
|
@ -135,21 +147,14 @@ class Selfmanga : ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
||||
val urlChapterNumber = Regex("${manga.url}/vol([0-9])/")
|
||||
val basic = Regex("""\s*([0-9]+)(\s-\s)([0-9]+)\s*""")
|
||||
val extra = Regex("""\s*([0-9]+\sЭкстра)\s*""")
|
||||
val single = Regex("""\s*Сингл\s*""")
|
||||
when {
|
||||
basic.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
}
|
||||
extra.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.name.replaceFirst(" ", " - " + chapter.chapter_number.toString() + " ")
|
||||
}
|
||||
|
||||
single.containsMatchIn(chapter.name) -> {
|
||||
chapter.chapter_number = chapter.url.split(urlChapterNumber)[1].toFloat()
|
||||
chapter.name = chapter.chapter_number.toString() + " " + chapter.name
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue