mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-11 04:20:48 +01:00
Improve regex for pages from Readmanga and Mintmanga (#345)
This commit is contained in:
parent
682a2c7546
commit
f0a382c21a
2 changed files with 6 additions and 6 deletions
|
@ -84,14 +84,14 @@ class Mintmanga(context: Context, override val id: Int) : ParsedOnlineSource(con
|
|||
val html = response.body().string()
|
||||
val beginIndex = html.indexOf("rm_h.init( [")
|
||||
val endIndex = html.indexOf("], 0, false);", beginIndex)
|
||||
val trimmedHtml = html.substring(beginIndex, endIndex).replace("[\"\']+".toRegex(), "")
|
||||
val trimmedHtml = html.substring(beginIndex, endIndex)
|
||||
|
||||
val p = Pattern.compile("auto/[\\w/]+,http://[\\w.]+/,/[\\w./]+.(png|jpg)+")
|
||||
val p = Pattern.compile("'.+?','.+?',\".+?\"")
|
||||
val m = p.matcher(trimmedHtml)
|
||||
|
||||
var i = 0
|
||||
while (m.find()) {
|
||||
val urlParts = m.group().split(',')
|
||||
val urlParts = m.group().replace("[\"\']+".toRegex(), "").split(',')
|
||||
pages.add(Page(i++, "", urlParts[1] + urlParts[0] + urlParts[2]))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,14 +84,14 @@ class Readmanga(context: Context, override val id: Int) : ParsedOnlineSource(con
|
|||
val html = response.body().string()
|
||||
val beginIndex = html.indexOf("rm_h.init( [")
|
||||
val endIndex = html.indexOf("], 0, false);", beginIndex)
|
||||
val trimmedHtml = html.substring(beginIndex, endIndex).replace("[\"\']+".toRegex(), "")
|
||||
val trimmedHtml = html.substring(beginIndex, endIndex)
|
||||
|
||||
val p = Pattern.compile("auto/[\\w/]+,http://[\\w.]+/,/[\\w./]+.(png|jpg)+")
|
||||
val p = Pattern.compile("'.+?','.+?',\".+?\"")
|
||||
val m = p.matcher(trimmedHtml)
|
||||
|
||||
var i = 0
|
||||
while (m.find()) {
|
||||
val urlParts = m.group().split(',')
|
||||
val urlParts = m.group().replace("[\"\']+".toRegex(), "").split(',')
|
||||
pages.add(Page(i++, "", urlParts[1] + urlParts[0] + urlParts[2]))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue