From f0a382c21a1ecaa738d0f3bbaf5817f360721c32 Mon Sep 17 00:00:00 2001 From: Taumer Date: Thu, 9 Jun 2016 20:48:23 +0300 Subject: [PATCH] Improve regex for pages from Readmanga and Mintmanga (#345) --- .../tachiyomi/data/source/online/russian/Mintmanga.kt | 6 +++--- .../tachiyomi/data/source/online/russian/Readmanga.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt index 723a8e281a..59703d485e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt @@ -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])) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt index 0ef28b0f87..42bcd180fb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt @@ -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])) } }