Fix cloudflare un-caught causes app crashing (#1178)
Fix cloudflare uncatch causes app crashing
This commit is contained in:
parent
bc4df5d008
commit
731145443b
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Hentai Cosplay'
|
extName = 'Hentai Cosplay'
|
||||||
extClass = '.HentaiCosplay'
|
extClass = '.HentaiCosplay'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,21 +138,23 @@ class HentaiCosplay : HttpSource() {
|
||||||
|
|
||||||
private fun fetchTags() {
|
private fun fetchTags() {
|
||||||
Single.fromCallable {
|
Single.fromCallable {
|
||||||
client.newCall(GET("$baseUrl/ranking-tag/", headers))
|
runCatching {
|
||||||
.execute().asJsoup()
|
client.newCall(GET("$baseUrl/ranking-tag/", headers))
|
||||||
.run {
|
.execute().asJsoup()
|
||||||
tagCache = buildList {
|
.run {
|
||||||
add(Pair("", ""))
|
tagCache = buildList {
|
||||||
select("#tags a").map {
|
add(Pair("", ""))
|
||||||
Pair(
|
select("#tags a").map {
|
||||||
it.text()
|
Pair(
|
||||||
.replace(tagNumRegex, "")
|
it.text()
|
||||||
.trim(),
|
.replace(tagNumRegex, "")
|
||||||
it.attr("href"),
|
.trim(),
|
||||||
).let(::add)
|
it.attr("href"),
|
||||||
|
).let(::add)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'TruyenGiHot'
|
extName = 'TruyenGiHot'
|
||||||
extClass = '.TruyenGiHot'
|
extClass = '.TruyenGiHot'
|
||||||
extVersionCode = 4
|
extVersionCode = 5
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,19 +285,21 @@ class TruyenGiHot : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Single.fromCallable {
|
Single.fromCallable {
|
||||||
val document = client.newCall(GET("$baseUrl/danh-sach-truyen.html", headers)).execute().asJsoup()
|
runCatching {
|
||||||
|
val document = client.newCall(GET("$baseUrl/danh-sach-truyen.html", headers)).execute().asJsoup()
|
||||||
|
|
||||||
val result = runCatching {
|
val result = runCatching {
|
||||||
tags = TruyenGiHotUtils.parseThemes(document.selectFirst("#contentTag")!!)
|
tags = TruyenGiHotUtils.parseThemes(document.selectFirst("#contentTag")!!)
|
||||||
themes = TruyenGiHotUtils.parseThemes(document.selectFirst("#contentTheme")!!)
|
themes = TruyenGiHotUtils.parseThemes(document.selectFirst("#contentTheme")!!)
|
||||||
scanlators = TruyenGiHotUtils.parseOptions(document.selectFirst("#contentGroup")!!)
|
scanlators = TruyenGiHotUtils.parseOptions(document.selectFirst("#contentGroup")!!)
|
||||||
}
|
|
||||||
.onFailure {
|
|
||||||
Log.e("TruyenGiHot", "Could not fetch filtering options", it)
|
|
||||||
}
|
}
|
||||||
|
.onFailure {
|
||||||
|
Log.e("TruyenGiHot", "Could not fetch filtering options", it)
|
||||||
|
}
|
||||||
|
|
||||||
fetchFiltersFailed = result.isFailure
|
fetchFiltersFailed = result.isFailure
|
||||||
fetchFiltersAttempts++
|
fetchFiltersAttempts++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
|
|
Loading…
Reference in New Issue