Fix build errors because of JSoup update

This commit is contained in:
Jobobby04 2021-07-18 20:18:20 -04:00
parent cf54851342
commit 65b6f7df44
6 changed files with 25 additions and 27 deletions

View File

@ -121,9 +121,9 @@ class EHentai(
// Do not parse header and ads
it.selectFirst("th") == null && it.selectFirst(".itd") == null
}.map { body ->
val thumbnailElement = body.selectFirst(".gl1e img, .gl2c .glthumb img")
val column2 = body.selectFirst(".gl3e, .gl2c")
val linkElement = body.selectFirst(".gl3c > a, .gl2e > div > a")
val thumbnailElement = body.selectFirst(".gl1e img, .gl2c .glthumb img")!!
val column2 = body.selectFirst(".gl3e, .gl2c")!!
val linkElement = body.selectFirst(".gl3c > a, .gl2e > div > a")!!
val infoElement = body.selectFirst(".gl3e")
// why is column2 null
@ -143,7 +143,7 @@ class EHentai(
thumbnail_url = thumbnailElement.attr("src")
if (infoElements != null) {
linkElement.select("div div")?.getOrNull(1)?.select("tr")?.forEach { row ->
linkElement.select("div div").getOrNull(1)?.select("tr")?.forEach { row ->
val namespace = row.select(".tc").text().removeSuffix(":")
parsedTags.addAll(
row.select("div").map { element ->
@ -160,7 +160,7 @@ class EHentai(
)
}
} else {
val tagElement = body.selectFirst(".gl3c > a")
val tagElement = body.selectFirst(".gl3c > a")!!
val tagElements = tagElement.select("div")
tagElements.forEach { element ->
if (element.className() == "gt") {
@ -198,8 +198,8 @@ class EHentai(
?.replace(" ", "")
)
val info = body.selectFirst(".gl2c")
val extraInfo = body.selectFirst(".gl4c")
val info = body.selectFirst(".gl2c")!!
val extraInfo = body.selectFirst(".gl4c")!!
val infoList = info.select("div div")
@ -308,7 +308,7 @@ class EHentai(
val parentLink = doc.select("#gdd .gdt1").find { el ->
el.text().lowercase() == "parent:"
}!!.nextElementSibling().selectFirst("a")?.attr("href")
}!!.nextElementSibling()!!.selectFirst("a")?.attr("href")
if (parentLink != null) {
updateHelper.parentLookupTable.put(
@ -332,12 +332,12 @@ class EHentai(
// Build chapter for root gallery
val self = ChapterInfo(
key = EHentaiSearchMetadata.normalizeUrl(doc.location()),
name = "v1: " + doc.selectFirst("#gn").text(),
name = "v1: " + doc.selectFirst("#gn")!!.text(),
number = 1f,
dateUpload = MetadataUtil.EX_DATE_FORMAT.parse(
doc.select("#gdd .gdt1").find { el ->
el.text().lowercase() == "posted:"
}!!.nextElementSibling().text()
}!!.nextElementSibling()!!.text()
)!!.time
)
// Build and append the rest of the galleries
@ -604,7 +604,7 @@ class EHentai(
// Parse the table
select("#gdd tr").forEach {
val left = it.select(".gdt1").text().trimOrNull()
val rightElement = it.selectFirst(".gdt2")
val rightElement = it.selectFirst(".gdt2")!!
val right = rightElement.text().trimOrNull()
if (left != null && right != null) {
ignore {
@ -689,7 +689,7 @@ class EHentai(
private fun realImageUrlParse(response: Response, page: Page): String {
with(response.asJsoup()) {
val currentImage = getElementById("img").attr("src")
val currentImage = getElementById("img")!!.attr("src")
// Each press of the retry button will choose another server
select("#loadfail").attr("onclick").nullIfBlank()?.let {
page.url = addParam(page.url, "nl", it.substring(it.indexOf('\'') + 1 until it.lastIndexOf('\'')))

View File

@ -48,11 +48,11 @@ class Hitomi(delegate: HttpSource, val context: Context) :
tags.clear()
thumbnailUrl = "https:" + input.selectFirst(".cover img").attr("src")
thumbnailUrl = "https:" + input.selectFirst(".cover img")!!.attr("src")
val galleryElement = input.selectFirst(".gallery")
val galleryElement = input.selectFirst(".gallery")!!
title = galleryElement.selectFirst("h1").text()
title = galleryElement.selectFirst("h1")!!.text()
artists = galleryElement.select("h2 a").map { it.text() }
tags += artists.map { RaisedTag("artist", it, RaisedSearchMetadata.TAG_TYPE_VIRTUAL) }
@ -107,7 +107,7 @@ class Hitomi(delegate: HttpSource, val context: Context) :
}
uploadDate = try {
DATE_FORMAT.parse(input.selectFirst(".gallery-info .date").text())!!.time
DATE_FORMAT.parse(input.selectFirst(".gallery-info .date")!!.text())!!.time
} catch (e: Exception) {
null
}

View File

@ -57,7 +57,7 @@ class PervEden(delegate: HttpSource, val context: Context) :
val newAltTitles = mutableListOf<String>()
tags.clear()
var inStatus: String? = null
rightBoxElement.childNodes().forEach {
rightBoxElement!!.childNodes().forEach {
if (it is Element && it.tagName().lowercase() == "h4") {
inStatus = it.text().trim()
} else {

View File

@ -59,7 +59,7 @@ class EightMuses(delegate: HttpSource, val context: Context) :
val breadcrumbs = input.selectFirst(".top-menu-breadcrumb > ol")
title = breadcrumbs.selectFirst("li:nth-last-child(1) > a").text()
title = breadcrumbs!!.selectFirst("li:nth-last-child(1) > a")!!.text()
thumbnailUrl = parseSelf(input).let { it.albums + it.images }.firstOrNull()
?.selectFirst(".lazyload")
@ -70,7 +70,7 @@ class EightMuses(delegate: HttpSource, val context: Context) :
tags.clear()
tags += RaisedTag(
EightMusesSearchMetadata.ARTIST_NAMESPACE,
breadcrumbs.selectFirst("li:nth-child(2) > a").text(),
breadcrumbs.selectFirst("li:nth-child(2) > a")!!.text(),
EightMusesSearchMetadata.TAG_TYPE_DEFAULT
)
tags += input.select(".album-tags a").map {

View File

@ -58,18 +58,18 @@ class Pururin(delegate: HttpSource, val context: Context) :
}
override suspend fun parseIntoMetadata(metadata: PururinSearchMetadata, input: Document) {
val selfLink = input.select("[itemprop=name]").last().parent()
val parsedSelfLink = selfLink.attr("href").toUri().pathSegments
val selfLink = input.select("[itemprop=name]").last()!!.parent()
val parsedSelfLink = selfLink!!.attr("href").toUri().pathSegments
with(metadata) {
prId = parsedSelfLink[parsedSelfLink.lastIndex - 1].toInt()
prShortLink = parsedSelfLink.last()
val contentWrapper = input.selectFirst(".content-wrapper")
title = contentWrapper.selectFirst(".title h1").text()
title = contentWrapper!!.selectFirst(".title h1")!!.text()
altTitle = contentWrapper.selectFirst(".alt-title")?.text()
thumbnailUrl = "https:" + input.selectFirst(".cover-wrapper v-lazy-image").attr("src")
thumbnailUrl = "https:" + input.selectFirst(".cover-wrapper v-lazy-image")!!.attr("src")
tags.clear()
contentWrapper.select(".table-gallery-info > tbody > tr").forEach { ele ->
@ -83,8 +83,8 @@ class Pururin(delegate: HttpSource, val context: Context) :
fileSize = split.last().removeSuffix(")").trim()
}
"ratings" -> {
ratingCount = value.selectFirst("[itemprop=ratingCount]").attr("content").toIntOrNull()
averageRating = value.selectFirst("[itemprop=ratingValue]").attr("content").toDoubleOrNull()
ratingCount = value.selectFirst("[itemprop=ratingCount]")!!.attr("content").toIntOrNull()
averageRating = value.selectFirst("[itemprop=ratingValue]")!!.attr("content").toDoubleOrNull()
}
"uploader" -> {
uploaderDisp = value.text()

View File

@ -338,8 +338,6 @@ object EXHMigrations {
// if (oldVersion under 1) { } (1 is current release version)
// do stuff here when releasing changed crap
// TODO BE CAREFUL TO NOT FUCK UP MergedSources IF CHANGING URLs
return true
}
} catch (e: Exception) {