fix load image from i0.wp.com komikcast (#1574)

fix load image from i0.wp.com komikcast
This commit is contained in:
Arif Ramadan 2019-09-28 20:55:52 +07:00 committed by arkon
parent 84e4d80a39
commit 4e45edd8cf
2 changed files with 13 additions and 6 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Komikcast'
pkgNameSuffix = 'id.komikcast'
extClass = '.Komikcast'
extVersionCode = 3
extVersionCode = 4
libVersion = '1.2'
}

View File

@ -187,7 +187,7 @@ class Komikcast : ParsedHttpSource() {
document.select("div#readerarea img").forEach { element ->
val url = element.attr("src")
i++
if (url.length != 0) {
if (url.length > 0) {
pages.add(Page(i, "", url))
}
}
@ -197,11 +197,18 @@ class Komikcast : ParsedHttpSource() {
override fun imageUrlParse(document: Document) = ""
override fun imageRequest(page: Page): Request {
val imgHeader = Headers.Builder().apply {
add("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30")
var headers = Headers.Builder()
headers.apply {
add("Referer", baseUrl)
}.build()
return GET(page.imageUrl!!, imgHeader)
add("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.100 Mobile Safari/537.36")
}
if (page.imageUrl!!.contains("i0.wp.com")) {
headers.apply {
add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3")
}
}
return GET(page.imageUrl!!, headers.build())
}
private class SortBy : UriPartFilter("Sort by", arrayOf(