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

View File

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

View File

@ -59,7 +59,7 @@ class EightMuses(delegate: HttpSource, val context: Context) :
val breadcrumbs = input.selectFirst(".top-menu-breadcrumb > ol") 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() thumbnailUrl = parseSelf(input).let { it.albums + it.images }.firstOrNull()
?.selectFirst(".lazyload") ?.selectFirst(".lazyload")
@ -70,7 +70,7 @@ class EightMuses(delegate: HttpSource, val context: Context) :
tags.clear() tags.clear()
tags += RaisedTag( tags += RaisedTag(
EightMusesSearchMetadata.ARTIST_NAMESPACE, EightMusesSearchMetadata.ARTIST_NAMESPACE,
breadcrumbs.selectFirst("li:nth-child(2) > a").text(), breadcrumbs.selectFirst("li:nth-child(2) > a")!!.text(),
EightMusesSearchMetadata.TAG_TYPE_DEFAULT EightMusesSearchMetadata.TAG_TYPE_DEFAULT
) )
tags += input.select(".album-tags a").map { 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) { override suspend fun parseIntoMetadata(metadata: PururinSearchMetadata, input: Document) {
val selfLink = input.select("[itemprop=name]").last().parent() val selfLink = input.select("[itemprop=name]").last()!!.parent()
val parsedSelfLink = selfLink.attr("href").toUri().pathSegments val parsedSelfLink = selfLink!!.attr("href").toUri().pathSegments
with(metadata) { with(metadata) {
prId = parsedSelfLink[parsedSelfLink.lastIndex - 1].toInt() prId = parsedSelfLink[parsedSelfLink.lastIndex - 1].toInt()
prShortLink = parsedSelfLink.last() prShortLink = parsedSelfLink.last()
val contentWrapper = input.selectFirst(".content-wrapper") val contentWrapper = input.selectFirst(".content-wrapper")
title = contentWrapper.selectFirst(".title h1").text() title = contentWrapper!!.selectFirst(".title h1")!!.text()
altTitle = contentWrapper.selectFirst(".alt-title")?.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() tags.clear()
contentWrapper.select(".table-gallery-info > tbody > tr").forEach { ele -> 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() fileSize = split.last().removeSuffix(")").trim()
} }
"ratings" -> { "ratings" -> {
ratingCount = value.selectFirst("[itemprop=ratingCount]").attr("content").toIntOrNull() ratingCount = value.selectFirst("[itemprop=ratingCount]")!!.attr("content").toIntOrNull()
averageRating = value.selectFirst("[itemprop=ratingValue]").attr("content").toDoubleOrNull() averageRating = value.selectFirst("[itemprop=ratingValue]")!!.attr("content").toDoubleOrNull()
} }
"uploader" -> { "uploader" -> {
uploaderDisp = value.text() uploaderDisp = value.text()

View File

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