Update css selectors (#1235)

This commit is contained in:
Secozzi
2023-02-05 01:20:26 +01:00
committed by GitHub
parent d651b419bc
commit 27486a32e2
2 changed files with 9 additions and 7 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'UHD Movies (Experimental)' extName = 'UHD Movies (Experimental)'
pkgNameSuffix = 'en.uhdmovies' pkgNameSuffix = 'en.uhdmovies'
extClass = '.UHDMovies' extClass = '.UHDMovies'
extVersionCode = 3 extVersionCode = 4
libVersion = '13' libVersion = '13'
} }

View File

@ -110,19 +110,19 @@ class UHDMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val response = client.newCall(GET(baseUrl + anime.url)).execute() val response = client.newCall(GET(baseUrl + anime.url)).execute()
val resp = response.asJsoup() val resp = response.asJsoup()
val episodeList = mutableListOf<SEpisode>() val episodeList = mutableListOf<SEpisode>()
val episodeElements = resp.select("p:has(a[href*=?id])[style*=center]") val episodeElements = resp.select("p:has(a[href*=?id])[style*=center],p:has(a[href*=?id]):has(span.maxbutton-1-center)")
val qualityRegex = "[0-9]{3,4}p".toRegex(RegexOption.IGNORE_CASE) val qualityRegex = "[0-9]{3,4}p".toRegex(RegexOption.IGNORE_CASE)
if (episodeElements.first().text().contains("Episode", true) || if (episodeElements.first().text().contains("Episode", true) ||
episodeElements.first().text().contains("Zip", true) episodeElements.first().text().contains("Zip", true)
) { ) {
episodeElements.map { row -> episodeElements.map { row ->
val prevP = row.previousElementSibling() val prevP = row.previousElementSibling()
val seasonRegex = "[ .]S(?:eason)?[ .]?([0-9]{1,2})[ .]".toRegex(RegexOption.IGNORE_CASE) val seasonRegex = "[ .]S(?:eason)?[ .]?([0-9]{1,2})[ .]".toRegex(RegexOption.IGNORE_CASE)
val result = seasonRegex.find(prevP.text()) val result = seasonRegex.find(prevP.text())
val season = ( val season = (
result?.groups?.get(1)?.value ?: let { result?.groups?.get(1)?.value ?: let {
val prevPre = row.previousElementSiblings().prev("pre") val prevPre = row.previousElementSiblings().prev("pre,div.mks_separator")
val preResult = seasonRegex.find(prevPre.first().text()) val preResult = seasonRegex.find(prevPre.first().text())
preResult?.groups?.get(1)?.value ?: let { preResult?.groups?.get(1)?.value ?: let {
val title = resp.select("h1.entry-title") val title = resp.select("h1.entry-title")
@ -137,7 +137,8 @@ class UHDMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
row.select("a").filter { row.select("a").filter {
!it.text().contains("Zip", true) && !it.text().contains("Zip", true) &&
!it.text().contains("Pack", true) !it.text().contains("Pack", true) &&
!it.text().contains("Volume ", true)
}.map { linkElement -> }.map { linkElement ->
val episode = linkElement.text().replace("Episode", "", true).trim() val episode = linkElement.text().replace("Episode", "", true).trim()
Triple( Triple(
@ -164,13 +165,14 @@ class UHDMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
var collectionIdx = 0F var collectionIdx = 0F
episodeElements.filter { episodeElements.filter {
!it.text().contains("Zip", true) && !it.text().contains("Zip", true) &&
!it.text().contains("Pack", true) !it.text().contains("Pack", true) &&
!it.text().contains("Volume ", true)
}.map { row -> }.map { row ->
val prevP = row.previousElementSibling() val prevP = row.previousElementSibling()
val qualityMatch = qualityRegex.find(prevP.text()) val qualityMatch = qualityRegex.find(prevP.text())
val quality = qualityMatch?.value ?: "HD" val quality = qualityMatch?.value ?: "HD"
val collectionName = row.previousElementSiblings().prev("h2").first().text() val collectionName = row.previousElementSiblings().prev("h1,h2,h3,pre").first().text()
.replace("Download", "", true).trim() .replace("Download", "", true).trim()
row.select("a").map { linkElement -> row.select("a").map { linkElement ->