Escape entities in Bato.to (#8613)
This commit is contained in:
parent
2e19d675ac
commit
51ff911e0e
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'Bato.to'
|
extName = 'Bato.to'
|
||||||
pkgNameSuffix = 'all.batoto'
|
pkgNameSuffix = 'all.batoto'
|
||||||
extClass = '.BatoToFactory'
|
extClass = '.BatoToFactory'
|
||||||
extVersionCode = 13
|
extVersionCode = 14
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import okhttp3.Request
|
|||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import org.jsoup.parser.Parser
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@ -57,7 +58,7 @@ open class BatoTo(
|
|||||||
val item = element.select("a.item-cover")
|
val item = element.select("a.item-cover")
|
||||||
val imgurl = item.select("img").attr("abs:src")
|
val imgurl = item.select("img").attr("abs:src")
|
||||||
manga.setUrlWithoutDomain(item.attr("href"))
|
manga.setUrlWithoutDomain(item.attr("href"))
|
||||||
manga.title = element.select("a.item-title").text()
|
manga.title = element.select("a.item-title").text().removeEntities()
|
||||||
manga.thumbnail_url = imgurl
|
manga.thumbnail_url = imgurl
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
@ -149,7 +150,7 @@ open class BatoTo(
|
|||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val infoElement = document.select("div#mainer div.container-fluid")
|
val infoElement = document.select("div#mainer div.container-fluid")
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.title = infoElement.select("h3").text()
|
manga.title = infoElement.select("h3").text().removeEntities()
|
||||||
manga.thumbnail_url = document.select("div.attr-cover img")
|
manga.thumbnail_url = document.select("div.attr-cover img")
|
||||||
.attr("abs:src")
|
.attr("abs:src")
|
||||||
manga.url = infoElement.select("h3 a").attr("abs:href")
|
manga.url = infoElement.select("h3 a").attr("abs:href")
|
||||||
@ -157,11 +158,9 @@ open class BatoTo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun queryParse(response: Response): MangasPage {
|
private fun queryParse(response: Response): MangasPage {
|
||||||
val mangas = mutableListOf<SManga>()
|
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
document.select(latestUpdatesSelector()).forEach { element ->
|
val mangas = document.select(latestUpdatesSelector())
|
||||||
mangas.add(latestUpdatesFromElement(element))
|
.map { element -> latestUpdatesFromElement(element) }
|
||||||
}
|
|
||||||
val nextPage = document.select(latestUpdatesNextPageSelector()).first() != null
|
val nextPage = document.select(latestUpdatesNextPageSelector()).first() != null
|
||||||
return MangasPage(mangas, nextPage)
|
return MangasPage(mangas, nextPage)
|
||||||
}
|
}
|
||||||
@ -181,15 +180,8 @@ open class BatoTo(
|
|||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
val infoElement = document.select("div#mainer div.container-fluid")
|
val infoElement = document.select("div#mainer div.container-fluid")
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
val genres = mutableListOf<String>()
|
|
||||||
val status = infoElement.select("div.attr-item:contains(status) span").text()
|
val status = infoElement.select("div.attr-item:contains(status) span").text()
|
||||||
infoElement.select("div.attr-item:contains(genres) span").text().split(
|
manga.title = infoElement.select("h3").text().removeEntities()
|
||||||
" / "
|
|
||||||
.toRegex()
|
|
||||||
).forEach { element ->
|
|
||||||
genres.add(element)
|
|
||||||
}
|
|
||||||
manga.title = infoElement.select("h3").text()
|
|
||||||
manga.author = infoElement.select("div.attr-item:contains(author) a:first-child").text()
|
manga.author = infoElement.select("div.attr-item:contains(author) a:first-child").text()
|
||||||
manga.artist = infoElement.select("div.attr-item:contains(author) a:last-child").text()
|
manga.artist = infoElement.select("div.attr-item:contains(author) a:last-child").text()
|
||||||
manga.status = parseStatus(status)
|
manga.status = parseStatus(status)
|
||||||
@ -337,6 +329,8 @@ open class BatoTo(
|
|||||||
|
|
||||||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
|
private fun String.removeEntities(): String = Parser.unescapeEntities(this, true)
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
// LetterFilter(),
|
// LetterFilter(),
|
||||||
Filter.Header("NOTE: Ignored if using text search!"),
|
Filter.Header("NOTE: Ignored if using text search!"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user