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' extName = 'PutLocker'
pkgNameSuffix = 'en.putlocker' pkgNameSuffix = 'en.putlocker'
extClass = '.PutLocker' extClass = '.PutLocker'
extVersionCode = 1 extVersionCode = 2
libVersion = '13' libVersion = '13'
} }

View File

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