Cleanup some delegation
This commit is contained in:
parent
428a9e82f3
commit
93fe927de2
@ -56,9 +56,9 @@ class Hitomi(delegate: HttpSource, val context: Context) :
|
|||||||
artists = galleryElement.select("h2 a").map { it.text() }
|
artists = galleryElement.select("h2 a").map { it.text() }
|
||||||
tags += artists.map { RaisedTag("artist", it, RaisedSearchMetadata.TAG_TYPE_VIRTUAL) }
|
tags += artists.map { RaisedTag("artist", it, RaisedSearchMetadata.TAG_TYPE_VIRTUAL) }
|
||||||
|
|
||||||
input.select(".gallery-info tr").forEach {
|
input.select(".gallery-info tr").forEach { galleryInfoElement ->
|
||||||
val content = it.child(1)
|
val content = galleryInfoElement.child(1)
|
||||||
when (it.child(0).text().toLowerCase()) {
|
when (galleryInfoElement.child(0).text().toLowerCase()) {
|
||||||
"group" -> {
|
"group" -> {
|
||||||
group = content.text()
|
group = content.text()
|
||||||
tags += RaisedTag("group", group!!, RaisedSearchMetadata.TAG_TYPE_VIRTUAL)
|
tags += RaisedTag("group", group!!, RaisedSearchMetadata.TAG_TYPE_VIRTUAL)
|
||||||
@ -91,9 +91,11 @@ class Hitomi(delegate: HttpSource, val context: Context) :
|
|||||||
}
|
}
|
||||||
"tags" -> {
|
"tags" -> {
|
||||||
tags += content.select("a").map {
|
tags += content.select("a").map {
|
||||||
val ns = if (it.attr("href").startsWith("/tag/male")) "male"
|
val ns = when {
|
||||||
else if (it.attr("href").startsWith("/tag/female")) "female"
|
it.attr("href").startsWith("/tag/male") -> "male"
|
||||||
else "misc"
|
it.attr("href").startsWith("/tag/female") -> "female"
|
||||||
|
else -> "misc"
|
||||||
|
}
|
||||||
RaisedTag(
|
RaisedTag(
|
||||||
ns,
|
ns,
|
||||||
it.text().dropLast(if (ns == "misc") 0 else 2),
|
it.text().dropLast(if (ns == "misc") 0 else 2),
|
||||||
|
@ -55,7 +55,7 @@ class NHentai(delegate: HttpSource, val context: Context) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun parseIntoMetadata(metadata: NHentaiSearchMetadata, input: Response) {
|
override suspend fun parseIntoMetadata(metadata: NHentaiSearchMetadata, input: Response) {
|
||||||
val json = GALLERY_JSON_REGEX.find(input.body!!.string())!!.groupValues[1].replace(
|
val json = GALLERY_JSON_REGEX.find(input.body?.string().orEmpty())!!.groupValues[1].replace(
|
||||||
UNICODE_ESCAPE_REGEX
|
UNICODE_ESCAPE_REGEX
|
||||||
) { it.groupValues[1].toInt(radix = 16).toChar().toString() }
|
) { it.groupValues[1].toInt(radix = 16).toChar().toString() }
|
||||||
val jsonResponse = jsonParser.decodeFromString<JsonResponse>(json)
|
val jsonResponse = jsonParser.decodeFromString<JsonResponse>(json)
|
||||||
|
@ -125,7 +125,7 @@ class PervEden(delegate: HttpSource, val context: Context) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun mapUrlToMangaUrl(uri: Uri): String? {
|
override suspend fun mapUrlToMangaUrl(uri: Uri): String {
|
||||||
val newUri = "http://www.perveden.com/".toUri().buildUpon()
|
val newUri = "http://www.perveden.com/".toUri().buildUpon()
|
||||||
uri.pathSegments.take(3).forEach {
|
uri.pathSegments.take(3).forEach {
|
||||||
newUri.appendPath(it)
|
newUri.appendPath(it)
|
||||||
|
@ -89,7 +89,7 @@ class EightMuses(delegate: HttpSource, val context: Context) :
|
|||||||
"8muses.com"
|
"8muses.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun mapUrlToMangaUrl(uri: Uri): String? {
|
override suspend fun mapUrlToMangaUrl(uri: Uri): String {
|
||||||
var path = uri.pathSegments.drop(2)
|
var path = uri.pathSegments.drop(2)
|
||||||
if (uri.pathSegments[1].toLowerCase() == "picture") {
|
if (uri.pathSegments[1].toLowerCase() == "picture") {
|
||||||
path = path.dropLast(1)
|
path = path.dropLast(1)
|
||||||
|
@ -80,7 +80,7 @@ class HBrowse(delegate: HttpSource, val context: Context) :
|
|||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun mapUrlToMangaUrl(uri: Uri): String? {
|
override suspend fun mapUrlToMangaUrl(uri: Uri): String? {
|
||||||
return "/${uri.pathSegments.first()}/c00001/"
|
return uri.pathSegments.firstOrNull()?.let { "/$it/c00001/" }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDescriptionAdapter(controller: MangaController): HBrowseDescriptionAdapter {
|
override fun getDescriptionAdapter(controller: MangaController): HBrowseDescriptionAdapter {
|
||||||
|
@ -62,7 +62,7 @@ class Pururin(delegate: HttpSource, val context: Context) :
|
|||||||
val parsedSelfLink = selfLink.attr("href").toUri().pathSegments
|
val parsedSelfLink = selfLink.attr("href").toUri().pathSegments
|
||||||
|
|
||||||
with(metadata) {
|
with(metadata) {
|
||||||
prId = parsedSelfLink[parsedSelfLink.lastIndex - 1].toIntOrNull()
|
prId = parsedSelfLink[parsedSelfLink.lastIndex - 1].toInt()
|
||||||
prShortLink = parsedSelfLink.last()
|
prShortLink = parsedSelfLink.last()
|
||||||
|
|
||||||
val contentWrapper = input.selectFirst(".content-wrapper")
|
val contentWrapper = input.selectFirst(".content-wrapper")
|
||||||
@ -112,7 +112,7 @@ class Pururin(delegate: HttpSource, val context: Context) :
|
|||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun mapUrlToMangaUrl(uri: Uri): String {
|
override suspend fun mapUrlToMangaUrl(uri: Uri): String {
|
||||||
return "${PururinSearchMetadata.BASE_URL}/gallery/${uri.pathSegments[1]}/${uri.lastPathSegment}"
|
return "${PururinSearchMetadata.BASE_URL}/gallery/${uri.pathSegments.getOrNull(1)}/${uri.lastPathSegment}"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDescriptionAdapter(controller: MangaController): PururinDescriptionAdapter {
|
override fun getDescriptionAdapter(controller: MangaController): PururinDescriptionAdapter {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user