mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 10:22:47 +01:00
HentaiFox: Fix thumbnails on mobile UAs (#691)
This commit is contained in:
parent
84b0d91aa2
commit
9912e4a598
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'HentaiFox'
|
||||
extClass = '.HentaiFox'
|
||||
extVersionCode = 4
|
||||
extVersionCode = 5
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class HentaiFox : ParsedHttpSource() {
|
||||
title = it.text()
|
||||
setUrlWithoutDomain(it.attr("href"))
|
||||
}
|
||||
thumbnail_url = element.select("img").first()!!.attr("abs:src")
|
||||
thumbnail_url = element.selectFirst("img")!!.imgAttr()
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ class HentaiFox : ParsedHttpSource() {
|
||||
title = info.select("h1").text()
|
||||
genre = info.select("ul.tags a").joinToString { it.ownText() }
|
||||
artist = info.select("ul.artists a").joinToString { it.ownText() }
|
||||
thumbnail_url = info.select("img").attr("abs:src")
|
||||
thumbnail_url = info.select("img").first()!!.imgAttr()
|
||||
description = info.select("ul.parodies a")
|
||||
.let { e -> if (e.isNotEmpty()) "Parodies: ${e.joinToString { it.ownText() }}\n\n" else "" }
|
||||
description += info.select("ul.characters a")
|
||||
@ -137,7 +137,7 @@ class HentaiFox : ParsedHttpSource() {
|
||||
}
|
||||
|
||||
override fun imageUrlParse(document: Document): String {
|
||||
return document.select("img#gimg").attr("abs:data-src")
|
||||
return document.selectFirst("img#gimg")!!.imgAttr()
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> = throw UnsupportedOperationException()
|
||||
@ -212,4 +212,12 @@ class HentaiFox : ParsedHttpSource() {
|
||||
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
||||
fun toUriPart() = vals[state].second
|
||||
}
|
||||
|
||||
private fun Element.imgAttr() = when {
|
||||
hasAttr("data-cfsrc") -> absUrl("data-cfsrc")
|
||||
hasAttr("data-src") -> absUrl("data-src")
|
||||
hasAttr("data-lazy-src") -> absUrl("data-lazy-src")
|
||||
hasAttr("srcset") -> absUrl("srcset").substringBefore(" ")
|
||||
else -> absUrl("src")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user