Jiangzaitoon: update domain, fix blurry thumbnails (#9815)
* Jiangzaitoon: update domain, fix blurry thumbnails Madara was also updated to allow overriding `String.getSrcSetImage()`, not bumping. * guard against malformed srcset candiate * remove duplicate trim
This commit is contained in:
parent
8361f4774f
commit
e6b34e2b2d
@ -788,7 +788,7 @@ abstract class Madara(
|
||||
/**
|
||||
* Get the best image quality available from srcset
|
||||
*/
|
||||
protected fun String.getSrcSetImage(): String? {
|
||||
protected open fun String.getSrcSetImage(): String? {
|
||||
return this.split(" ")
|
||||
.filter(URL_REGEX::matches)
|
||||
.maxOfOrNull(String::toString)
|
||||
|
@ -2,8 +2,8 @@ ext {
|
||||
extName = 'Jiangzaitoon'
|
||||
extClass = '.Jiangzaitoon'
|
||||
themePkg = 'madara'
|
||||
baseUrl = 'https://jiangzaitoon.wtf'
|
||||
overrideVersionCode = 11
|
||||
baseUrl = 'https://jiangzaitoon.lgbt'
|
||||
overrideVersionCode = 12
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit
|
||||
|
||||
class Jiangzaitoon : Madara(
|
||||
"Jiangzaitoon",
|
||||
"https://jiangzaitoon.wtf",
|
||||
"https://jiangzaitoon.lgbt",
|
||||
"tr",
|
||||
SimpleDateFormat("d MMM yyy", Locale("tr")),
|
||||
) {
|
||||
@ -22,4 +22,27 @@ class Jiangzaitoon : Madara(
|
||||
}
|
||||
|
||||
override val chapterUrlSelector = "> a"
|
||||
|
||||
override fun String.getSrcSetImage(): String? {
|
||||
/* Assumption: URL is absolute
|
||||
* Assumption: descriptor is always in width
|
||||
*/
|
||||
return this
|
||||
.split(",")
|
||||
.mapNotNull { candidate ->
|
||||
candidate
|
||||
.trim()
|
||||
.split(" ", limit = 2)
|
||||
.takeIf { it.size == 2 }
|
||||
?.let { (url, desc) ->
|
||||
desc
|
||||
.takeIf { it.endsWith("w") }
|
||||
?.removeSuffix("w")
|
||||
?.toIntOrNull()
|
||||
?.let { size -> url to size }
|
||||
}
|
||||
}
|
||||
.maxByOrNull { it.second }
|
||||
?.first
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user