Skip to content

Commit

Permalink
Remove warnings (this belongs on rr, report on amazon etc) from RR (#217
Browse files Browse the repository at this point in the history
)
  • Loading branch information
AbdullahM0hamed authored Jan 25, 2024
1 parent ba6575e commit b6c451b
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,18 @@ class RoyalRoadProvider : MainAPI() {
override suspend fun loadHtml(url: String): String? {
val response = app.get(url)
val document = Jsoup.parse(response.text)
return document.selectFirst("div.chapter-content")?.html()
val styles = document.select("style")
val hiddenRegex = Regex("^\\s*(\\..*)\\s*\\{", RegexOption.MULTILINE)
val chap = document.selectFirst("div.chapter-content")
styles.forEach { style ->
hiddenRegex.findAll(style.toString()).forEach {
val className = it.groupValues.get(1)
if (!className.isNullOrEmpty()) {
chap?.select(className)?.remove()
}
}
}

return chap?.html()
}
}
}

0 comments on commit b6c451b

Please sign in to comment.