PutLocker: fix full episodes not listing (#1037)

This commit is contained in:
Samfun75
2022-11-22 15:23:10 +03:00
committed by GitHub
parent 17ec32dec1
commit 9f13e91b00
2 changed files with 26 additions and 29 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'PutLocker'
pkgNameSuffix = 'en.putlocker'
extClass = '.PutLocker'
extVersionCode = 1
extVersionCode = 2
libVersion = '13'
}

View File

@ -109,13 +109,14 @@ class PutLocker : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} ?: SAnime.COMPLETED
var description = descElement.select("div.desc").text()?.let { it + "\n" }
document.select("div.mvic-info > div.mvici-right p:contains(Quality)").text().let {
val extraDescription = document.select("div.mvic-info > div.mvici-right")
extraDescription.select("p:contains(Quality)").text().let {
description += if (it.isNotBlank()) "\n$it" else ""
}
document.select("div.mvic-info > div.mvici-right p:contains(Release)").text().let {
extraDescription.select("p:contains(Release)").text().let {
description += if (it.isNotBlank()) "\n$it" else ""
}
document.select("div.mvic-info > div.mvici-right p:contains(IMDb)").text().let {
extraDescription.select("p:contains(IMDb)").text().let {
description += if (it.isNotBlank()) "\n$it" else ""
}
anime.description = description
@ -135,34 +136,30 @@ class PutLocker : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val parsedHtml = Jsoup.parse(JSONUtil.unescape(html))
val rawEpisodes = parsedHtml.select("div[id^=sv]").mapNotNull { server ->
val linkElement = server.select("div.les-content > a")
val dataId = linkElement.attr("data-id")!!
val ep = dataId.substringAfter("_").substringBefore("_").toInt()
val title = if (ep == 0) {
"Movie"
} else {
val epWithNumber = linkElement.text()
"Episode $ep: " + linkElement.attr("title").substringAfter(epWithNumber)
.replace("-", "").trim()
linkElement.map { epLinkElement ->
val dataId = epLinkElement.attr("data-id")!!
val ep = dataId.substringAfter("_").substringBefore("_").toInt()
val title = if (ep == 0) {
"Movie"
} else {
"Episode $ep: " + epLinkElement.attr("title").substringAfter("Episode $ep")
.replace("-", "").trim()
}
Pair(title, dataId)
}
Pair(title, dataId)
}
}.flatten()
val episodes = mutableListOf<SEpisode>()
rawEpisodes.groupBy { it.second.substringAfter("_").substringBefore("_").toInt() }
.map { group ->
val title = group.value.first().first
episodes.add(
SEpisode.create().apply {
url = EpLinks(
ep_num = group.key,
ids = group.value.map { it.second }
).toJson()
name = title
episode_number = group.key.toFloat()
}
)
return rawEpisodes.groupBy { it.second.substringAfter("_").substringBefore("_").toInt() }
.mapNotNull { group ->
SEpisode.create().apply {
url = EpLinks(
ep_num = group.key,
ids = group.value.map { it.second }
).toJson()
name = group.value.first().first
episode_number = group.key.toFloat()
}
}
return episodes
}
override fun episodeListSelector(): String = throw Exception("Not Used")