|
|
|
@ -106,9 +106,16 @@ internal class BatCave(context: MangaLoaderContext) :
|
|
|
|
val dateFormat = SimpleDateFormat("dd.MM.yyyy", Locale.US)
|
|
|
|
val dateFormat = SimpleDateFormat("dd.MM.yyyy", Locale.US)
|
|
|
|
|
|
|
|
|
|
|
|
val scriptData = doc.selectFirst("script:containsData(__DATA__)")?.data()
|
|
|
|
val scriptData = doc.selectFirst("script:containsData(__DATA__)")?.data()
|
|
|
|
?.substringAfter("window.__DATA__ = ")
|
|
|
|
?.let { data ->
|
|
|
|
?.substringBefore(";")
|
|
|
|
val jsonStart = data.indexOf("window.__DATA__ = ") + "window.__DATA__ = ".length
|
|
|
|
?: doc.parseFailed("Script data not found")
|
|
|
|
val jsonEnd = data.indexOf("};", startIndex = jsonStart)
|
|
|
|
|
|
|
|
if (jsonEnd != -1) {
|
|
|
|
|
|
|
|
// substring, include "}" symbol
|
|
|
|
|
|
|
|
data.substring(jsonStart, jsonEnd + 1)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} ?: doc.parseFailed("Script data not found")
|
|
|
|
|
|
|
|
|
|
|
|
val jsonData = JSONObject(scriptData)
|
|
|
|
val jsonData = JSONObject(scriptData)
|
|
|
|
val newsId = jsonData.getLong("news_id")
|
|
|
|
val newsId = jsonData.getLong("news_id")
|
|
|
|
|