Mangas.in: Optimize unescaping (#193)

Optimize unescaping
This commit is contained in:
bapeey 2024-01-12 14:52:57 -05:00 committed by GitHub
parent c5c2a09392
commit 8db4e2e856
2 changed files with 7 additions and 10 deletions

View File

@ -108,28 +108,25 @@ class MangasIn : MMRCMS("Mangas.in", "https://mangas.in", "es") {
}
private fun String.unescape(): String {
return UNESCAPE_REGEX.replace(this) {
it.groupValues[1]
}
return UNESCAPE_REGEX.replace(this, "$1")
}
private fun String.unescapeJava(): String {
var escaped = this
if (!escaped.contains("\\u")) return escaped
var processed = ""
val builder = StringBuilder()
var position = escaped.indexOf("\\u")
while (position != -1) {
if (position != 0) {
processed += escaped.substring(0, position)
builder.append(escaped, 0, position)
}
val token = escaped.substring(position + 2, position + 6)
escaped = escaped.substring(position + 6)
processed += Integer.parseInt(token, 16).toChar()
builder.append(Integer.parseInt(token, 16).toChar())
position = escaped.indexOf("\\u")
}
processed += escaped
return processed
builder.append(escaped)
return builder.toString()
}
private fun String.parseDate(): Long {

View File

@ -19,7 +19,7 @@ class MMRCMSGenerator : ThemeSourceGenerator {
SingleLang("Scan VF", "https://www.scan-vf.net", "fr", overrideVersionCode = 1),
SingleLang("Komikid", "https://www.komikid.com", "id"),
SingleLang("Mangadoor", "https://mangadoor.com", "es", overrideVersionCode = 1),
SingleLang("Mangas.in", "https://mangas.in", "es", isNsfw = true, className = "MangasIn"),
SingleLang("Mangas.in", "https://mangas.in", "es", isNsfw = true, className = "MangasIn", overrideVersionCode = 1),
SingleLang("Utsukushii", "https://manga.utsukushii-bg.com", "bg", overrideVersionCode = 1),
SingleLang("Phoenix-Scans", "https://phoenix-scans.pl", "pl", className = "PhoenixScans", overrideVersionCode = 1),
SingleLang("Lelscan-VF", "https://lelscanvf.cc", "fr", className = "LelscanVF", overrideVersionCode = 2),